Skip to content

Commit

Permalink
msgq: check MAP_FAILED instead of NULL for mmap (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Aug 4, 2024
1 parent 45110ff commit 622de23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion msgq/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 622de23

Please sign in to comment.