src/config/datastore.rs: use backup gid instead of uid

This commit is contained in:
Dietmar Maurer 2019-12-18 12:20:41 +01:00
parent 864d17c4e2
commit f8ec1473be

View File

@ -58,8 +58,8 @@ pub fn config() -> Result<SectionConfigData, Error> {
pub fn save_config(config: &SectionConfigData) -> Result<(), Error> {
let raw = CONFIG.write(DATASTORE_CFG_FILENAME, &config)?;
let (backup_uid, _) = crate::tools::getpwnam_ugid("backup")?;
let gid = nix::unistd::Gid::from_raw(backup_uid);
let (_, backup_gid) = crate::tools::getpwnam_ugid("backup")?;
let gid = nix::unistd::Gid::from_raw(backup_gid);
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640);
// set the correct owner/group/permissions while saving file
// owner(rw) = root, group(r)= backup