summaryrefslogtreecommitdiff
path: root/zip.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-11-04 20:15:42 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-11-04 20:25:10 -0700
commitfa0feeca560a412d513696aca15e41e755c62254 (patch)
treef921a671e54995fa77910e10ca6292ff6679bdf8 /zip.c
parent3e1af5b7abc005ac8070f1f5b3b433afb9099793 (diff)
downloadgzip-fa0feeca560a412d513696aca15e41e755c62254.tar.gz
gzip --no-name: avoid spurious warning
Problem reported by Jim Meyering (Bug#24826). * tests/timestamp: Add a test from Jim Meyering to exercise the fix * zip.c (zip): Treat unknown time stamps as 0.
Diffstat (limited to 'zip.c')
-rw-r--r--zip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/zip.c b/zip.c
index eb60409..a3b4559 100644
--- a/zip.c
+++ b/zip.c
@@ -54,7 +54,9 @@ int zip(in, out)
flags |= ORIG_NAME;
}
put_byte(flags); /* general flags */
- if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff)
+ if (time_stamp.tv_nsec < 0)
+ stamp = 0;
+ else if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff)
stamp = time_stamp.tv_sec;
else
{