Skip to content

Commit

Permalink
Don't delete a .zip file with more than one entry.
Browse files Browse the repository at this point in the history
To be consistent with gzip, pigz will delete the compressed file
once it has completed decompression. This applies to both gzip and
zip files. However it only decompresses the first entry in a zip
file. If there is more than one entry in the zip file, pigz would
delete it even though not all of the zip contents were extracted.
This commit prevents the deletion of the zip file if entries after
the first are detected.
  • Loading branch information
madler committed Jan 23, 2021
1 parent bf19597 commit 3b031d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pigz.c
Expand Up @@ -3568,8 +3568,10 @@ local void infchk(void) {
cat();

// check for more entries in zip file
else if (more)
else if (more) {
complain("warning: %s: entries after the first were ignored", g.inf);
g.keep = 1; // don't delete the .zip file
}

// check for non-gzip after gzip stream, or anything after zlib stream
else if ((g.verbosity > 1 && g.form == 0 && ret != -1) ||
Expand Down

0 comments on commit 3b031d5

Please sign in to comment.