mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
bin: fix file permission regression in /cfg/startup-config.cfg
admin@infix-00-00-00:~$ less /cfg/startup-config.cfg cat: can't open '/cfg/startup-config.cfg': Permission denied /cfg/startup-config.cfg: Permission denied admin@infix-00-00-00:~$ ls -l /cfg/ total 16 -rw------- 1 root wheel 13655 Jun 14 12:59 startup-config.cfg Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+8
-1
@@ -138,9 +138,16 @@ static void set_owner(const char *fn, const char *user)
|
||||
if (chown(fn, -1, gid) && errno != EPERM) {
|
||||
const struct group *gr = getgrgid(gid);
|
||||
|
||||
warn("setting group owner %s (%d) on %s",
|
||||
warn("failed setting group owner %s (%d) on %s",
|
||||
gr ? gr->gr_name : "<unknown>", gid, fn);
|
||||
}
|
||||
|
||||
/* Make sure the group we just set can actually read/write the file.
|
||||
* umask alone can't: the datastore export goes through a 0600 mkstemp
|
||||
* temp and cp(1) propagates that mode to the destination.
|
||||
*/
|
||||
if (chmod(fn, 0660) && errno != EPERM)
|
||||
warn("failed setting mode 0660 on %s", fn);
|
||||
}
|
||||
|
||||
static const char *infix_ds(const char *text, const struct infix_ds **ds)
|
||||
|
||||
Reference in New Issue
Block a user