source:
npl/system/klibc/patches/gzip-fix-silent-fallback-to-decompression.patch
@
892871d
Last change on this file since 892871d was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 2.4 KB |
-
usr/gzip/gzip.c
From: Ben Hutchings <ben@decadent.org.uk> Date: Fri, 18 Sep 2015 21:59:17 +0200 Subject: gzip: Fix silent fallback to decompression Bug-Debian: https://bugs.debian.org/355809 Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003892.html If the gzip utilities are built without support for compression, they will always attempt to carry out decompression even if the command name and options don't imply that. Instead they should fail with an explicit error in this case. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> ---
a b int level = 6; /* compression lev 90 90 #endif 91 91 92 92 int to_stdout; /* output to stdout (-c) */ 93 #ifndef decompress 93 #ifdef decompress 94 int decompress_wanted; 95 #else 94 96 int decompress; /* decompress (-d) */ 97 #define decompress_wanted decompress 95 98 #endif 96 99 int force; /* don't ask questions, compress links (-f) */ 97 100 int no_name = -1; /* don't save or restore the original file name */ … … int main (argc, argv) 259 262 * Systems which do not support links can still use -d or -dc. 260 263 * Ignore an .exe extension for MSDOS, OS/2 and VMS. 261 264 */ 262 #ifndef decompress263 265 if ( strncmp(progname, "un", 2) == 0 /* ungzip, uncompress */ 264 266 || strncmp(progname, "gun", 3) == 0) { /* gunzip */ 265 decompress = 1;267 decompress_wanted = 1; 266 268 } 267 #endif268 269 if (strequ(progname+1, "cat") /* zcat, pcat, gcat */ 269 270 || strequ(progname, "gzcat")) { /* gzcat */ 270 #ifndef decompress 271 decompress = 1; 272 #endif 271 decompress_wanted = 1; 273 272 to_stdout = 1; 274 273 } 275 274 #endif … … int main (argc, argv) 282 281 case 'c': 283 282 to_stdout = 1; break; 284 283 case 'd': 285 #ifndef decompress 286 decompress = 1; 287 #endif 284 decompress_wanted = 1; 288 285 break; 289 286 case 'f': 290 287 force++; break; … … int main (argc, argv) 308 305 break; 309 306 case 't': 310 307 test = to_stdout = 1; 311 #ifndef decompress 312 decompress = 1; 313 #endif 308 decompress_wanted = 1; 314 309 break; 315 310 case 'v': 316 311 verbose++; quiet = 0; break; … … int main (argc, argv) 329 324 } 330 325 } /* loop on all arguments */ 331 326 327 #ifndef SUPPORT_ZIP 328 if (!decompress_wanted) { 329 fprintf(stderr, "%s: this version does not support compression\n", 330 progname); 331 do_exit(ERROR); 332 } 333 #endif 334 332 335 /* By default, save name and timestamp on compression but do not 333 336 * restore them on decompression. 334 337 */
Note: See TracBrowser
for help on using the repository browser.