diff options
-rw-r--r-- | archival/gzip.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index a93d2175a..46367f9e6 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -2007,7 +2007,7 @@ static void ct_init(void) | |||
2007 | * IN assertions: the input and output buffers are cleared. | 2007 | * IN assertions: the input and output buffers are cleared. |
2008 | */ | 2008 | */ |
2009 | 2009 | ||
2010 | static void zip(ulg time_stamp) | 2010 | static void zip(void) |
2011 | { | 2011 | { |
2012 | ush deflate_flags = 0; /* pkzip -es, -en or -ex equivalent */ | 2012 | ush deflate_flags = 0; /* pkzip -es, -en or -ex equivalent */ |
2013 | 2013 | ||
@@ -2018,7 +2018,7 @@ static void zip(ulg time_stamp) | |||
2018 | /* compression method: 8 (DEFLATED) */ | 2018 | /* compression method: 8 (DEFLATED) */ |
2019 | /* general flags: 0 */ | 2019 | /* general flags: 0 */ |
2020 | put_32bit(0x00088b1f); | 2020 | put_32bit(0x00088b1f); |
2021 | put_32bit(time_stamp); | 2021 | put_32bit(0); /* Unix timestamp */ |
2022 | 2022 | ||
2023 | /* Write deflated file to zip file */ | 2023 | /* Write deflated file to zip file */ |
2024 | G1.crc = ~0; | 2024 | G1.crc = ~0; |
@@ -2044,8 +2044,6 @@ static void zip(ulg time_stamp) | |||
2044 | static | 2044 | static |
2045 | IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_state_t *xstate UNUSED_PARAM) | 2045 | IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_state_t *xstate UNUSED_PARAM) |
2046 | { | 2046 | { |
2047 | struct stat s; | ||
2048 | |||
2049 | /* Clear input and output buffers */ | 2047 | /* Clear input and output buffers */ |
2050 | G1.outcnt = 0; | 2048 | G1.outcnt = 0; |
2051 | #ifdef DEBUG | 2049 | #ifdef DEBUG |
@@ -2077,9 +2075,23 @@ IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_state_t *xstate UNUSED | |||
2077 | G2.bl_desc.max_length = MAX_BL_BITS; | 2075 | G2.bl_desc.max_length = MAX_BL_BITS; |
2078 | //G2.bl_desc.max_code = 0; | 2076 | //G2.bl_desc.max_code = 0; |
2079 | 2077 | ||
2078 | #if 0 | ||
2079 | /* Saving of timestamp is disabled. Why? | ||
2080 | * - it is not Y2038-safe. | ||
2081 | * - some people want deterministic results | ||
2082 | * (normally they'd use -n, but our -n is a nop). | ||
2083 | * - it's bloat. | ||
2084 | * Per RFC 1952, gzfile.time=0 is "no timestamp". | ||
2085 | * If users will demand this to be reinstated, | ||
2086 | * implement -n "don't save timestamp". | ||
2087 | */ | ||
2088 | struct stat s; | ||
2080 | s.st_ctime = 0; | 2089 | s.st_ctime = 0; |
2081 | fstat(STDIN_FILENO, &s); | 2090 | fstat(STDIN_FILENO, &s); |
2082 | zip(s.st_ctime); | 2091 | zip(s.st_ctime); |
2092 | #else | ||
2093 | zip(); | ||
2094 | #endif | ||
2083 | return 0; | 2095 | return 0; |
2084 | } | 2096 | } |
2085 | 2097 | ||