msgq: check MAP_FAILED instead of NULL for mmap (#614)

This commit is contained in:
Dean Lee 2024-08-05 05:53:06 +08:00 committed by GitHub
parent 45110ffb9b
commit 622de235f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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;