diff options
author | Simo Sorce <idra@samba.org> | 2008-09-03 10:44:09 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-09-03 14:25:33 -0400 |
commit | 04691de379fa692b22fc9f0b58c0bd829ce7cc7a (patch) | |
tree | f5b920a8355ff1f5786c40920081273c6f27ae17 /source3/lib/tdb/common/io.c | |
parent | c5894e14771562bccd153a98610722632ca3956a (diff) | |
download | samba-04691de379fa692b22fc9f0b58c0bd829ce7cc7a.tar.gz samba-04691de379fa692b22fc9f0b58c0bd829ce7cc7a.tar.bz2 samba-04691de379fa692b22fc9f0b58c0bd829ce7cc7a.zip |
The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here.
(This used to be commit 74c8575b3f3b90ea21ae6aa7ccd95947838af956)
Diffstat (limited to 'source3/lib/tdb/common/io.c')
-rw-r--r-- | source3/lib/tdb/common/io.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/lib/tdb/common/io.c b/source3/lib/tdb/common/io.c index 172ab69d8c..4ec18de48e 100644 --- a/source3/lib/tdb/common/io.c +++ b/source3/lib/tdb/common/io.c @@ -189,7 +189,13 @@ int tdb_munmap(struct tdb_context *tdb) #ifdef HAVE_MMAP if (tdb->map_ptr) { - int ret = munmap(tdb->map_ptr, tdb->map_size); + int ret; + + ret = msync(tdb->map_ptr, tdb->map_size, MS_SYNC); + if (ret != 0) + return ret; + + ret = munmap(tdb->map_ptr, tdb->map_size); if (ret != 0) return ret; } |