mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
check for MAP_FAILED result
This commit is contained in:
parent
b48405744e
commit
521da856b5
@ -166,7 +166,7 @@ main(int argc, const char *argv[])
|
|||||||
*/
|
*/
|
||||||
addr = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
|
addr = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
|
||||||
MAP_FILE | MAP_SHARED, fd, 0);
|
MAP_FILE | MAP_SHARED, fd, 0);
|
||||||
if (addr == NULL) {
|
if (addr == NULL || addr == MAP_FAILED) {
|
||||||
(void)fprintf(stderr, "%s: could not mmap %s: %s\n",
|
(void)fprintf(stderr, "%s: could not mmap %s: %s\n",
|
||||||
progname, filename, strerror(errno));
|
progname, filename, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user