compress: fix mmap error handling

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2015-10-14 10:15:27 -04:00
parent 9f35e8b458
commit e068517205
+2 -2
View File
@@ -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) {