summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-21 19:56:25 +0000
committerJeremy Allison <jra@samba.org>2001-06-21 19:56:25 +0000
commit460c9061909de2715eb1ff6737402d017e346d66 (patch)
treef368763e9e08e48c81ec629891ffafbd85e81436
parent99c506325fa92be811d07a79969d5cae67750b10 (diff)
downloadsamba-460c9061909de2715eb1ff6737402d017e346d66.tar.gz
samba-460c9061909de2715eb1ff6737402d017e346d66.tar.bz2
samba-460c9061909de2715eb1ff6737402d017e346d66.zip
Ok - I misspoke.... mmap returns MAP_FAILED, not neccessarily -1 :-).
Jeremy. (This used to be commit 2d1c6d1f6b55a0a78eb8afbe16d2ad8b3253a220)
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index c27f03fc35..97c8e00ae6 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -66,6 +66,10 @@
#define MAP_FILE 0
#endif
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
#define BUCKET(hash) ((hash) % tdb->header.hash_size)
TDB_DATA tdb_null;
@@ -89,10 +93,10 @@ static void tdb_mmap(TDB_CONTEXT *tdb)
MAP_SHARED|MAP_FILE, tdb->fd, 0);
/*
- * NB. When mmap fails it returns -1 *NOT* NULL !!!!
+ * NB. When mmap fails it returns MAP_FAILED *NOT* NULL !!!!
*/
- if (tdb->map_ptr == (void *)-1) {
+ if (tdb->map_ptr == MAP_FAILED) {
tdb->map_ptr = NULL;
TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n",
tdb->map_size, strerror(errno)));