From: Zbigniew Jędrzejewski-Szmek Date: Wed, 14 Oct 2015 14:15:27 +0000 (-0400) Subject: compress: fix mmap error handling X-Git-Tag: v228~198^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e06851720573d3adb4be54a1decfe35bc750b8f4;p=thirdparty%2Fsystemd.git compress: fix mmap error handling --- diff --git a/src/journal/compress.c b/src/journal/compress.c index 8e8403f6f8b..4ada0f12fd7 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -460,7 +460,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) { return -EINVAL; src = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fdf, 0); - if (!src) + if (src == MAP_FAILED) return -errno; log_debug("Buffer size is %zu bytes, header size %zu bytes.", size, n); @@ -688,7 +688,7 @@ static int decompress_stream_lz4_v2(int in, int out, uint64_t max_bytes) { return -ENOMEM; src = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, in, 0); - if (!src) + if (src == MAP_FAILED) return -errno; while (total_in < (size_t) st.st_size) {