diff options
author | bapt <bapt@FreeBSD.org> | 2012-11-20 07:22:07 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2012-11-20 07:22:07 +0000 |
commit | 9acb3e40c2b5badc282bac6ad0196dbbb3f443c7 (patch) | |
tree | 42b71f5868052fe7f59b75db49bcadc1f96b42e2 /lib/libutil | |
parent | f5a468d92ec241c832092a10507e86363404fceb (diff) | |
download | FreeBSD-src-9acb3e40c2b5badc282bac6ad0196dbbb3f443c7.zip FreeBSD-src-9acb3e40c2b5badc282bac6ad0196dbbb3f443c7.tar.gz |
change mode the group file to 0644 after a successfull rename(2)
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/gr_util.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c index 6d96d5e..8d0490b 100644 --- a/lib/libutil/gr_util.c +++ b/lib/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); } /* |