mmap does not return null on failure, but MAP_FAILED. Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- risu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/risu.c b/risu.c index 36fc82a..6b6295c 100644 --- a/risu.c +++ b/risu.c @@ -362,10 +362,9 @@ static void load_image(const char *imgfile) /* Map writable because we include the memory area for store * testing in the image. */ - addr = - mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, - 0); - if (!addr) { + addr = mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, fd, 0); + if (addr == MAP_FAILED) { perror("mmap"); exit(EXIT_FAILURE); } -- 2.34.1