Jim Meyering wrote: ... > Thanks for the report. > Here's a proposed patch. > As you know, it should make no difference on Linux > (other than the additional syscall). > Can you confirm that it solves the problem on Cygwin? ... > Subject: [PATCH] * gzip.c: Include "timespec.h".
I've pushed that with a slightly different log: >From cad194d49efdb478ae0acf9355ab2ffe4d650739 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Fri, 19 Mar 2010 18:09:20 +0100 Subject: [PATCH] do not use stat.st_mtime of a non-regular file * gzip.c: Include "timespec.h". (treat_stdin): Use st_mtime only from a regular file. This matters at least on Cygwin 1.7.1-1, for which a stdin-pipe has the mtime of /dev/null, rather than the gzip-documented-for-pipes "current time". Reported by Denis Excoffier. --- THANKS | 1 + gzip.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/THANKS b/THANKS index b0833e5..a69f832 100644 --- a/THANKS +++ b/THANKS @@ -74,6 +74,7 @@ Paul Eggert egg...@cs.ucla.edu Enami en...@sys.ptg.sony.co.jp Kristoffer Eriksson s...@pkmab.se Daniel Eriksson m91...@bellatrix.tdb.uu.se +Denis Excoffier 3.1...@free.fr Rik Faith fa...@cs.unc.edu Larry Fahnoe fah...@c1mpls.mn.org Cristian Ferretti c...@poincare.mat.puc.cl diff --git a/gzip.c b/gzip.c index d1105e5..41322ec 100644 --- a/gzip.c +++ b/gzip.c @@ -67,6 +67,7 @@ static char const *const license_msg[] = { #include "gzip.h" #include "lzw.h" #include "revision.h" +#include "timespec.h" #include "fcntl-safer.h" #include "getopt.h" @@ -648,7 +649,12 @@ local void treat_stdin() ifile_size = S_ISREG (istat.st_mode) ? istat.st_size : -1; time_stamp.tv_nsec = -1; if (!no_time || list) - time_stamp = get_stat_mtime (&istat); + { + if (S_ISREG (istat.st_mode)) + time_stamp = get_stat_mtime (&istat); + else + gettime (&time_stamp); + } clear_bufs(); /* clear input and output buffers */ to_stdout = 1; -- 1.7.0.2.455.g91132