From 2e0035dac827b2552263d777276eca08922b4b94 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 11 Dec 2014 10:43:44 +0200 Subject: [PATCH] posix: fix file_desc::map() error checking mmap(2) returns MAP_FAILED on error, not nullptr. --- core/posix.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/posix.hh b/core/posix.hh index f020127ee9..e28fcd7a89 100644 --- a/core/posix.hh +++ b/core/posix.hh @@ -228,7 +228,7 @@ public: void *map(size_t size, unsigned flags, bool shared, size_t offset) { void *x = mmap(NULL, size, flags, shared ? MAP_SHARED : MAP_PRIVATE, _fd, offset); - throw_system_error_on(x == nullptr); + throw_system_error_on(x == MAP_FAILED); return x; }