From: Toon Claes Date: Mon, 04 Aug 2025 16:56:33 GMT Subject: [PATCH 2/4] archive-zip: remove unneccesarry condition in write_zip_entry() Message-ID: <20250804-toon-archive-zip-fix-v1-2-ca89858e5eaa@iotcl.com> In-Reply-To: <20250804-toon-archive-zip-fix-v1-0-ca89858e5eaa@iotcl.com> The function write_or_die() can handle a length that's zero, thus we can remove the condition that checks the value of `out_len` that surrounds this call. The value shall never be negative as this would have caused data being omitted in the deflated output. Co-authored-by: Justin Tobler Signed-off-by: Toon Claes --- archive-zip.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/archive-zip.c b/archive-zip.c index cc6d0cadd9..d41a12de5f 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -478,11 +478,8 @@ static int write_zip_entry(struct archiver_args *args, die(_("deflate error (%d)"), result); out_len = zstream.next_out - compressed; - if (out_len > 0) { - write_or_die(1, compressed, out_len); - compressed_size += out_len; - } - + write_or_die(1, compressed, out_len); + compressed_size += out_len; } close_istream(stream); if (readlen) -- 2.50.1.327.g047016eb4a