summaryrefslogtreecommitdiffstats
path: root/pw/pw_nis.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-11-20 14:05:46 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-11-20 14:05:46 +0000
commitf1c19efaaef09572d044b5d2656c4ee623dea092 (patch)
tree690da57faf94702666c95a5c8bd6fa94490c3557 /pw/pw_nis.c
parentef34619dbd59da6485c17838c174b91c7938c05a (diff)
downloadpw-darwin-f1c19efaaef09572d044b5d2656c4ee623dea092.tar.gz
pw-darwin-f1c19efaaef09572d044b5d2656c4ee623dea092.tar.zst
pw-darwin-f1c19efaaef09572d044b5d2656c4ee623dea092.zip
In NIS mode first chmod(2) the temporary file and is succeed then rename(2)
Diffstat (limited to 'pw/pw_nis.c')
-rw-r--r--pw/pw_nis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pw/pw_nis.c b/pw/pw_nis.c
index 7af2bef..918fc30 100644
--- a/pw/pw_nis.c
+++ b/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();