]> git.cworth.org Git - gzip/commitdiff
Imported Debian patch 1.3.5-10sarge1
authorBdale Garbee <bdale@gag.com>
Wed, 9 Nov 2005 05:25:19 +0000 (22:25 -0700)
committerBdale Garbee <bdale@gag.com>
Fri, 6 Jun 2008 04:29:26 +0000 (22:29 -0600)
debian/changelog
gzip.c
gzip.h

index 740739ec70ed0a783793aa9ef551d2d0cd923f63..58cd01764b5e6b639025324c4fa3d1eb56e799ad 100644 (file)
@@ -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 <bdale@gag.com>  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 61f721e6ed725d3375e88755e3522d607f1f84fe..2f692b5658327d6e33ee21abcfe0ce53709a9647 100644 (file)
--- 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 3629a55164eeef4f0e4b11ed5704cf02fef75801..e3cc75c355fe41a577435f8211d08e6517dd4481 100644 (file)
--- 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));