/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (C) 1996
* David L. Nugent. All rights reserved.
*
#endif /* not lint */
#include <sys/types.h>
+
#include <err.h>
#include <pwd.h>
#include <libutil.h>
+#include <unistd.h>
#include "pw.h"
struct passwd *pw = NULL;
struct passwd *old_pw = NULL;
+ printf("===> %s\n", path);
if (pwd != NULL)
pw = pw_dup(pwd);
}
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)