X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/1af8005a676fd422a362171657eb20e2c6659764..HEAD:/pw/pw_nis.c diff --git a/pw/pw_nis.c b/pw/pw_nis.c index 918fc30..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. * @@ -29,13 +31,12 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include -#include #include + #include #include #include +#include #include "pw.h" @@ -46,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); @@ -64,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)