T: bugfix: fix check on return value of mmap

This commit is contained in:
Cedric Roux
2018-04-24 14:40:28 +02:00
parent 184d51c6ea
commit 7576e3fa52
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
if (T_shm_fd == -1) { perror(T_SHM_FILENAME); abort(); }
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
if (T_cache == NULL)
if (T_cache == MAP_FAILED)
{ perror(T_SHM_FILENAME); abort(); }
close(T_shm_fd);
+1 -1
View File
@@ -335,7 +335,7 @@ static void init_shm(void)
{ perror(T_SHM_FILENAME); abort(); }
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
if (T_local_cache == NULL)
if (T_local_cache == MAP_FAILED)
{ perror(T_SHM_FILENAME); abort(); }
close(s);