summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-21 19:50:21 +0000
committerJeremy Allison <jra@samba.org>2001-06-21 19:50:21 +0000
commit99c506325fa92be811d07a79969d5cae67750b10 (patch)
treeab25417475d08175c69632e2c323d9602585a92c /source3/tdb
parent3a6019b0eb8a71e8f7fb04fbce384f4478ebe2dd (diff)
downloadsamba-99c506325fa92be811d07a79969d5cae67750b10.tar.gz
samba-99c506325fa92be811d07a79969d5cae67750b10.tar.bz2
samba-99c506325fa92be811d07a79969d5cae67750b10.zip
When mmap fails it returns -1 *NOT NULL*.
This got regressed somehow..... Jeremy. (This used to be commit b77c8b536d4b6d2162f4932227f01cffb730c645)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 4d4fb79383..c27f03fc35 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -87,7 +87,13 @@ static void tdb_mmap(TDB_CONTEXT *tdb)
tdb->map_ptr = mmap(NULL, tdb->map_size,
PROT_READ|(tdb->read_only? 0:PROT_WRITE),
MAP_SHARED|MAP_FILE, tdb->fd, 0);
- if (!tdb->map_ptr) {
+
+ /*
+ * NB. When mmap fails it returns -1 *NOT* NULL !!!!
+ */
+
+ if (tdb->map_ptr == (void *)-1) {
+ tdb->map_ptr = NULL;
TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n",
tdb->map_size, strerror(errno)));
}