Skip to content

Commit

Permalink
Put modification times in the gzip header only for regular files.
Browse files Browse the repository at this point in the history
This replicates the behavior of gzip since version 1.10. The intent
is to make piped applications of pigz produce deterministic output.
Note that input redirected from a regular file is still a regular
file.
  • Loading branch information
madler committed Aug 20, 2023
1 parent 907ca07 commit fb4222c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pigz.c
Original file line number Diff line number Diff line change
Expand Up @@ -3922,8 +3922,8 @@ local void process(char *path) {
vstrcpy(&g.inf, &g.inz, 0, "<stdin>");
g.ind = 0;
g.name = NULL;
g.mtime = g.headis & 2 ?
(fstat(g.ind, &st) ? time(NULL) : st.st_mtime) : 0;
g.mtime = (g.headis & 2) && fstat(g.ind, &st) == 0 &&
S_ISREG(st.st_mode) ? st.st_mtime : 0;
len = 0;
}
else {
Expand Down

0 comments on commit fb4222c

Please sign in to comment.