From 622de235f726432eb20e01c1d98a9c8e04b418c3 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 5 Aug 2024 05:53:06 +0800 Subject: [PATCH] msgq: check MAP_FAILED instead of NULL for mmap (#614) --- msgq/msgq.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msgq/msgq.cc b/msgq/msgq.cc index fed2959..5ce25a3 100644 --- a/msgq/msgq.cc +++ b/msgq/msgq.cc @@ -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;