mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
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 commit is contained in:
parent
8e4dca3b94
commit
74c8575b3f
@ -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;
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
|
||||
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction: fsync failed\n"));
|
||||
return -1;
|
||||
}
|
||||
#ifdef MS_SYNC
|
||||
#ifdef HAVE_MMAP
|
||||
if (tdb->map_ptr) {
|
||||
tdb_off_t moffset = offset & ~(tdb->page_size-1);
|
||||
if (msync(moffset + (char *)tdb->map_ptr,
|
||||
|
Loading…
Reference in New Issue
Block a user