https://gitlab.com/xonotic/darkplaces/-/merge_requests/55
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12815
d7cf8633-e32d-0410-b094-
e92efae38249
#if FILE_BACKED_MALLOC
#include <stdlib.h>
#include <sys/mman.h>
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0
+#endif
typedef struct mmap_data_s
{
size_t len;
data = (unsigned char *) mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, fd, 0);
close(fd);
unlink(vabuf);
- if(!data)
+ if(!data || data == (void *)-1)
return NULL;
data->len = size;
return (void *) (data + 1);