diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2012-11-20 07:22:07 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2012-11-20 07:22:07 +0000 |
commit | 1082433740913c828bc90af27621772b81cf4b17 (patch) | |
tree | 8f07991c2c3b71d04bf59bfbdf28042a1432b1c5 /libutil | |
parent | bd4634fe5dc7808ab33b20afb9d42dcc36f0b4d9 (diff) | |
download | pw-darwin-1082433740913c828bc90af27621772b81cf4b17.tar.gz pw-darwin-1082433740913c828bc90af27621772b81cf4b17.tar.zst pw-darwin-1082433740913c828bc90af27621772b81cf4b17.zip |
change mode the group file to 0644 after a successfull rename(2)
Diffstat (limited to 'libutil')
-rw-r--r-- | libutil/gr_util.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libutil/gr_util.c b/libutil/gr_util.c index 6d96d5e..8d0490b 100644 --- a/libutil/gr_util.c +++ b/libutil/gr_util.c @@ -318,7 +318,14 @@ gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr) int gr_mkdb(void) { - return (rename(tempname, group_file)); + int ret; + + ret = rename(tempname, group_file); + + if (ret == 0) + chmod(group_file, 0644); + + return (ret); } /* |