Index: lib/libutil/gr_util.c =================================================================== --- lib/libutil/gr_util.c +++ lib/libutil/gr_util.c @@ -141,7 +141,7 @@ errno = ENAMETOOLONG; return (-1); } - if ((tfd = mkostemp(tempname, O_SYNC)) == -1) + if ((tfd = mkostemp(tempname, 0)) == -1) return (-1); if (mfd != -1) { while ((nr = read(mfd, buf, sizeof(buf))) > 0) Index: lib/libutil/pw_util.c =================================================================== --- lib/libutil/pw_util.c +++ lib/libutil/pw_util.c @@ -225,7 +225,7 @@ errno = ENAMETOOLONG; return (-1); } - if ((tfd = mkostemp(tempname, O_SYNC)) == -1) + if ((tfd = mkostemp(tempname, 0)) == -1) return (-1); if (mfd != -1) { while ((nr = read(mfd, buf, sizeof(buf))) > 0) Index: usr.sbin/pw/grupd.c =================================================================== --- usr.sbin/pw/grupd.c +++ usr.sbin/pw/grupd.c @@ -77,6 +77,7 @@ close(tfd); err(1, "gr_copy()"); } + fsync(tfd); close(tfd); if (gr_mkdb() == -1) { gr_fini(); Index: usr.sbin/pw/pw_nis.c =================================================================== --- usr.sbin/pw/pw_nis.c +++ usr.sbin/pw/pw_nis.c @@ -67,6 +67,7 @@ close(tfd); err(1, "pw_copy()"); } + fsync(tfd); close(tfd); if (chmod(pw_tempname(), 0644) == -1) err(1, "chmod()"); Index: usr.sbin/pw/pwupd.c =================================================================== --- usr.sbin/pw/pwupd.c +++ usr.sbin/pw/pwupd.c @@ -114,6 +114,7 @@ close(tfd); err(1, "pw_copy()"); } + fsync(tfd); close(tfd); /* * in case of deletion of a user, the whole database