From: Christian Brauner Date: Sat, 16 Nov 2019 11:41:13 +0000 (+0100) Subject: clone.2: Check for MAP_FAILED not NULL on mmap() X-Git-Tag: man-pages-5.04~9 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=8eea66b8b;p=thirdparty%2Fman-pages.git clone.2: Check for MAP_FAILED not NULL on mmap() If mmap() fails it will return MAP_FAILED which according to the manpage is (void *)-1 not NULL. Signed-off-by: Christian Brauner Signed-off-by: Michael Kerrisk --- diff --git a/man2/clone.2 b/man2/clone.2 index 57a9eaba77..faff2ada68 100644 --- a/man2/clone.2 +++ b/man2/clone.2 @@ -1628,7 +1628,7 @@ main(int argc, char *argv[]) stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, \-1, 0); - if (stack == NULL) + if (stack == MAP_FAILED) errExit("mmap"); stackTop = stack + STACK_SIZE; /* Assume stack grows downward */