In NIS mode first chmod(2) the temporary file and is succeed then rename(2)

This commit is contained in:
Baptiste Daroussin 2012-11-20 14:05:46 +00:00
parent 09259e6c48
commit 4efe6c741d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243335

View File

@ -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();