X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/dfac825697674070ff717c02263d3aab9c9d62bd..3de6f8f6ed62ac8b9b8f7635a7c4bb48b06322ca:/pw/pw_nis.c diff --git a/pw/pw_nis.c b/pw/pw_nis.c index c786cc7..4b70bc1 100644 --- a/pw/pw_nis.c +++ b/pw/pw_nis.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (C) 1996 * David L. Nugent. All rights reserved. * @@ -30,9 +32,11 @@ static const char rcsid[] = #endif /* not lint */ #include + #include #include #include +#include #include "pw.h" @@ -43,6 +47,7 @@ pw_nisupdate(const char * path, struct passwd * pwd, char const * user) struct passwd *pw = NULL; struct passwd *old_pw = NULL; + printf("===> %s\n", path); if (pwd != NULL) pw = pw_dup(pwd); @@ -61,8 +66,11 @@ pw_nisupdate(const char * path, struct passwd * pwd, char const * user) } if (pw_copy(pfd, tfd, pw, old_pw) == -1) { pw_fini(); + close(tfd); err(1, "pw_copy()"); } + fsync(tfd); + close(tfd); if (chmod(pw_tempname(), 0644) == -1) err(1, "chmod()"); if (rename(pw_tempname(), path) == -1)