From c692fab1c2ff0de2554c5940f77ac8c168e729b2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Dec 2022 15:08:10 +0100 Subject: pkg/image: treat empty compressed image as valid image When we decompress images for mutation or hints, we always specially check for empty compressed data (I assume it can apper after minimization). Treat it as correct compressed and return empty decompressed data. This removes the need in special handling in users. --- executor/common_zlib.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'executor/common_zlib.h') diff --git a/executor/common_zlib.h b/executor/common_zlib.h index 5d37cd0e0..fdbd9d4b6 100644 --- a/executor/common_zlib.h +++ b/executor/common_zlib.h @@ -469,10 +469,8 @@ static int puff( static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { // Ignore zlib header. - if (sourcelen < ZLIB_HEADER_WIDTH) { - errno = EMSGSIZE; - return -1; - } + if (sourcelen < ZLIB_HEADER_WIDTH) + return 0; source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; -- cgit mrf-deployment