X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/23971dd8b6775706a0462efe817e02ab9a876078..3de6f8f6ed62ac8b9b8f7635a7c4bb48b06322ca:/pw/pw_nis.c diff --git a/pw/pw_nis.c b/pw/pw_nis.c index 6cc361b..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. * @@ -34,6 +36,7 @@ static const char rcsid[] = #include #include #include +#include #include "pw.h" @@ -63,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)