From cf32d8987e502849a4a3ed61baa03c4ef6a9cdb5 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 8 Nov 2005 22:25:19 -0700 Subject: [PATCH] Imported Debian patch 1.3.5-10sarge1 --- debian/changelog | 8 ++++++++ gzip.c | 34 ++++++++++++++++++++++++++-------- gzip.h | 2 +- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 740739e..58cd017 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +gzip (1.3.5-10sarge1) stable; urgency=low + + * merge patch from Matt Zimmerman for futex hang due to improper signal + handling, closes: #310053, #315612 + * backport to stable since this problem affects several debian.org servers + + -- Bdale Garbee Tue, 8 Nov 2005 22:25:19 -0700 + gzip (1.3.5-10) unstable; urgency=medium * remove PAGER reference from zmore.1, closes: #263792 diff --git a/gzip.c b/gzip.c index 61f721e..2f692b5 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); + (void) signal (SIGINT, (sig_type)abort_gzip_signal); } #ifdef SIGTERM if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { - (void) signal(SIGTERM, (sig_type)abort_gzip); + (void) signal(SIGTERM, (sig_type)abort_gzip_signal); } #endif #ifdef SIGHUP if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { - (void) signal(SIGHUP, (sig_type)abort_gzip); + (void) signal(SIGHUP, (sig_type)abort_gzip_signal); } #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 (SIGPIPE, (sig_type) abort_gzip_signal); #endif /* By default, save name and timestamp on compression but do not @@ -1850,13 +1850,31 @@ local void do_exit(exitcode) } /* ======================================================================== - * Signal and error handler. + * Close and unlink the output file if appropriate. This routine must be + * async-signal-safe. */ -RETSIGTYPE abort_gzip() -{ +local void do_remove() { 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); +} + diff --git a/gzip.h b/gzip.h index 3629a55..e3cc75c 100644 --- a/gzip.h +++ b/gzip.h @@ -273,7 +273,7 @@ extern int unpack OF((int in, int out)); extern int unlzh OF((int in, int out)); /* in gzip.c */ -RETSIGTYPE abort_gzip OF((void)); +RETSIGTYPE abort_gzip_signal OF((void)); /* in deflate.c */ void lm_init OF((int pack_level, ush *flags)); -- 2.43.0