diff options
author | bapt <bapt@FreeBSD.org> | 2012-11-20 14:05:46 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2012-11-20 14:05:46 +0000 |
commit | 1bf34f2c1b3ef18d8e5645ab80ed174d76b2feef (patch) | |
tree | 737a68941d3194541ddf2b427408eef183bef935 /usr.sbin/pw | |
parent | 2ed31d29a136b086906cadaedceedd82398b9e7b (diff) | |
download | FreeBSD-src-1bf34f2c1b3ef18d8e5645ab80ed174d76b2feef.zip FreeBSD-src-1bf34f2c1b3ef18d8e5645ab80ed174d76b2feef.tar.gz |
In NIS mode first chmod(2) the temporary file and is succeed then rename(2)
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/pw_nis.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pw/pw_nis.c b/usr.sbin/pw/pw_nis.c index 7af2bef..918fc30 100644 --- a/usr.sbin/pw/pw_nis.c +++ b/usr.sbin/pw/pw_nis.c @@ -66,10 +66,10 @@ pw_nisupdate(const char * path, struct passwd * pwd, char const * user) pw_fini(); err(1, "pw_copy()"); } + if (chmod(pw_tempname(), 0644) == -1) + err(1, "chmod()"); if (rename(pw_tempname(), path) == -1) err(1, "rename()"); - if (chmod(path, 0644) == -1) - err(1, "chmod()"); free(pw); pw_fini(); |