1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

When mmap fails it returns -1 *NOT NULL*.

This got regressed somehow.....
Jeremy.
(This used to be commit b77c8b536d)
This commit is contained in:
Jeremy Allison 2001-06-21 19:50:21 +00:00
parent 3a6019b0eb
commit 99c506325f

View File

@ -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)));
}