summaryrefslogtreecommitdiff
path: root/src/journal/compress.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-10-14 10:15:27 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-10-14 10:15:27 -0400
commite06851720573d3adb4be54a1decfe35bc750b8f4 (patch)
treea38244ab785a3da1356a29b89cb9bca3f0ffadd5 /src/journal/compress.c
parent9f35e8b45894f7e201878e128ca371662a9dc63d (diff)
compress: fix mmap error handling
Diffstat (limited to 'src/journal/compress.c')
-rw-r--r--src/journal/compress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/compress.c b/src/journal/compress.c
index 8e8403f6f8..4ada0f12fd 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) {