summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libutil/gr_util.c2
-rw-r--r--libutil/pw_util.c2
-rw-r--r--pw/grupd.c1
-rw-r--r--pw/pw_nis.c1
-rw-r--r--pw/pwupd.c1
5 files changed, 5 insertions, 2 deletions
diff --git a/libutil/gr_util.c b/libutil/gr_util.c
index 93b3eb2..6153209 100644
--- a/libutil/gr_util.c
+++ b/libutil/gr_util.c
@@ -141,7 +141,7 @@ gr_tmp(int mfd)
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)
diff --git a/libutil/pw_util.c b/libutil/pw_util.c
index 2838871..d790328 100644
--- a/libutil/pw_util.c
+++ b/libutil/pw_util.c
@@ -225,7 +225,7 @@ pw_tmp(int mfd)
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)
diff --git a/pw/grupd.c b/pw/grupd.c
index 38d5e5b..5d0df02 100644
--- a/pw/grupd.c
+++ b/pw/grupd.c
@@ -77,6 +77,7 @@ gr_update(struct group * grp, char const * group)
close(tfd);
err(1, "gr_copy()");
}
+ fsync(tfd);
close(tfd);
if (gr_mkdb() == -1) {
gr_fini();
diff --git a/pw/pw_nis.c b/pw/pw_nis.c
index 35b26ea..087c946 100644
--- a/pw/pw_nis.c
+++ b/pw/pw_nis.c
@@ -67,6 +67,7 @@ pw_nisupdate(const char * path, struct passwd * pwd, char const * user)
close(tfd);
err(1, "pw_copy()");
}
+ fsync(tfd);
close(tfd);
if (chmod(pw_tempname(), 0644) == -1)
err(1, "chmod()");
diff --git a/pw/pwupd.c b/pw/pwupd.c
index 3bcb95f..87c3c99 100644
--- a/pw/pwupd.c
+++ b/pw/pwupd.c
@@ -114,6 +114,7 @@ pw_update(struct passwd * pwd, char const * user)
close(tfd);
err(1, "pw_copy()");
}
+ fsync(tfd);
close(tfd);
/*
* in case of deletion of a user, the whole database