summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2016-03-06 18:22:24 +0000
committerdwmalone <dwmalone@FreeBSD.org>2016-03-06 18:22:24 +0000
commit8526db178678c940e9594ff82ef9746ae465950d (patch)
tree5219127c39d2af2e4e08c66ed070c68ec8952376 /lib
parentc7e729e17dd576bdb128a6846969f5d29e5de93e (diff)
downloadFreeBSD-src-8526db178678c940e9594ff82ef9746ae465950d.zip
FreeBSD-src-8526db178678c940e9594ff82ef9746ae465950d.tar.gz
Merge 296424 from stable/10 - contains the following changes to -current:
r295924: Make sure that hash-based db files fsync befor closing/syncing. r295925: We no longer need O_SYNC pwd_mkd r295465: We no longer need O_SYNC on services_mkdb r295800: We no longer need O_SYNC on cap_mkdb Approved by: re (marius)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/db/hash/hash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index af80929..333b1a1 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -422,8 +422,10 @@ hdestroy(HTAB *hashp)
if (hashp->tmp_buf)
free(hashp->tmp_buf);
- if (hashp->fp != -1)
+ if (hashp->fp != -1) {
+ (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
+ }
free(hashp);
@@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags)
return (0);
if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
return (ERROR);
+ if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+ return (ERROR);
hashp->new_file = 0;
return (0);
}
OpenPOWER on IntegriCloud