X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gzip.c;h=61f721e6ed725d3375e88755e3522d607f1f84fe;hb=0095746c83f59e1f45c9e803d61e205ab6cbfa83;hp=2f692b5658327d6e33ee21abcfe0ce53709a9647;hpb=8ba3484138b5d1e72fd4ef49d27159263cb6bea6;p=gzip diff --git a/gzip.c b/gzip.c index 2f692b5..61f721e 100644 --- a/gzip.c +++ b/gzip.c @@ -467,16 +467,16 @@ int main (argc, argv) foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { - (void) signal (SIGINT, (sig_type)abort_gzip_signal); + (void) signal (SIGINT, (sig_type)abort_gzip); } #ifdef SIGTERM if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { - (void) signal(SIGTERM, (sig_type)abort_gzip_signal); + (void) signal(SIGTERM, (sig_type)abort_gzip); } #endif #ifdef SIGHUP if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { - (void) signal(SIGHUP, (sig_type)abort_gzip_signal); + (void) signal(SIGHUP, (sig_type)abort_gzip); } #endif @@ -586,7 +586,7 @@ int main (argc, argv) #ifdef SIGPIPE /* Ignore "Broken Pipe" message with --quiet */ if (quiet && signal (SIGPIPE, SIG_IGN) != SIG_IGN) - signal (SIGPIPE, (sig_type) abort_gzip_signal); + signal (SIGPIPE, (sig_type) abort_gzip); #endif /* By default, save name and timestamp on compression but do not @@ -1850,31 +1850,13 @@ local void do_exit(exitcode) } /* ======================================================================== - * Close and unlink the output file if appropriate. This routine must be - * async-signal-safe. + * Signal and error handler. */ -local void do_remove() { +RETSIGTYPE abort_gzip() +{ if (remove_ofname) { close(ofd); xunlink (ofname); } + do_exit(ERROR); } - -/* ======================================================================== - * Error handler. - */ -RETSIGTYPE abort_gzip() -{ - do_remove(); - do_exit(ERROR); -} - -/* ======================================================================== - * Signal handler. - */ -RETSIGTYPE abort_gzip_signal() -{ - do_remove(); - _exit(ERROR); -} -