]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pwupd.c
Remove an uneeded indentation introduced in r286196 to silence gcc warnging
[pw-darwin.git] / pw / pwupd.c
index f9e1959f44a7c3d9de10179bdc5505113e4889b7..ac91c9e4c1bb38ea63bc81b610fca1f7024b4147 100644 (file)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (C) 1996
  *     David L. Nugent.  All rights reserved.
  *
@@ -29,18 +31,16 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <pwd.h>
+#include <libutil.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <pwd.h>
-#include <libutil.h>
-#include <errno.h>
-#include <err.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/wait.h>
 
 #include "pwupd.h"
 
@@ -113,8 +113,11 @@ pw_update(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);
        /*
         * in case of deletion of a user, the whole database
         * needs to be regenerated