Skip to content

Commit

Permalink
Check MAP_FAILED Instead of NULL for mmap
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed May 27, 2024
1 parent 51cbf62 commit 303278e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion messaging/msgq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){
char * mem = (char*)mmap(NULL, size + sizeof(msgq_header_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);

if (mem == NULL){
if (mem == MAP_FAILED){
return -1;
}
q->mmap_p = mem;
Expand Down

0 comments on commit 303278e

Please sign in to comment.