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:
parent
3a6019b0eb
commit
99c506325f
@ -87,7 +87,13 @@ static void tdb_mmap(TDB_CONTEXT *tdb)
|
|||||||
tdb->map_ptr = mmap(NULL, tdb->map_size,
|
tdb->map_ptr = mmap(NULL, tdb->map_size,
|
||||||
PROT_READ|(tdb->read_only? 0:PROT_WRITE),
|
PROT_READ|(tdb->read_only? 0:PROT_WRITE),
|
||||||
MAP_SHARED|MAP_FILE, tdb->fd, 0);
|
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_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n",
|
||||||
tdb->map_size, strerror(errno)));
|
tdb->map_size, strerror(errno)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user