posix: fix file_desc::map() error checking

mmap(2) returns MAP_FAILED on error, not nullptr.
This commit is contained in:
Avi Kivity
2014-12-11 10:43:44 +02:00
parent c95927f223
commit 2e0035dac8

View File

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