Commit 7576e3fa authored by Cedric Roux's avatar Cedric Roux

T: bugfix: fix check on return value of mmap

parent 184d51c6
...@@ -147,7 +147,7 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork) ...@@ -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(); } if (T_shm_fd == -1) { perror(T_SHM_FILENAME); abort(); }
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t), T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
if (T_cache == NULL) if (T_cache == MAP_FAILED)
{ perror(T_SHM_FILENAME); abort(); } { perror(T_SHM_FILENAME); abort(); }
close(T_shm_fd); close(T_shm_fd);
......
...@@ -335,7 +335,7 @@ static void init_shm(void) ...@@ -335,7 +335,7 @@ static void init_shm(void)
{ perror(T_SHM_FILENAME); abort(); } { perror(T_SHM_FILENAME); abort(); }
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t), T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0); PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
if (T_local_cache == NULL) if (T_local_cache == MAP_FAILED)
{ perror(T_SHM_FILENAME); abort(); } { perror(T_SHM_FILENAME); abort(); }
close(s); close(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment