Fix problems in porting to NSK reported by Matthew Woehlke in
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Dec 2006 01:19:52 +0000 (01:19 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Dec 2006 01:19:52 +0000 (01:19 +0000)
<http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00025.html> and
<http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00027.html>.
* gzip.h: Include <limits.h>, for SSIZE_MAX.
(INBUFSIZE): Don't make it any larger than SSIZE_MAX.
Problem reported by Matthew Woehlke in
<http://lists.gnu.org/archive/html/bug-gzip/2006-11/msg00013.html>.
* gzip.c: Don't include <limits.h>, as gzip.h now does this.
* util.c: Likewise.
* gzip.c (main): Set exiting_signal before installing signal handlers.
(install_signal_handlers): Don't set exiting_signal here.  This
fixes a C99ism.
* zip.c: Include timespec.h, for time_stamp type.

ChangeLog
gzip.c
gzip.h
util.c
zip.c

index 2bfb01cfc68532caa264ec000b3d502e59e282d3..7ebeca93650aa0105f6cf0ac58bbc36a2e05d704 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-12-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix problems in porting to NSK reported by Matthew Woehlke in
+       <http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00025.html> and
+       <http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00027.html>.
+       * gzip.h: Include <limits.h>, for SSIZE_MAX.
+       (INBUFSIZE): Don't make it any larger than SSIZE_MAX.
+       Problem reported by Matthew Woehlke in
+       <http://lists.gnu.org/archive/html/bug-gzip/2006-11/msg00013.html>.
+       * gzip.c: Don't include <limits.h>, as gzip.h now does this.
+       * util.c: Likewise.
+       * gzip.c (main): Set exiting_signal before installing signal handlers.
+       (install_signal_handlers): Don't set exiting_signal here.  This
+       fixes a C99ism.
+       * zip.c: Include timespec.h, for time_stamp type.
+
 2006-12-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>  (tiny change)
 
        * gzexe.in: Work around FreeBSD shell trap bug.
diff --git a/gzip.c b/gzip.c
index 7e17497cae8a00b03e731ffc5676e27e0c8b4218..d1aeb78b517877a569fb4b056e873a33a4a03c4a 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -85,10 +85,6 @@ static char rcsid[] = "$Id$";
 #  include <fcntl.h>
 #endif
 
-#ifdef HAVE_LIMITS_H
-#  include <limits.h>
-#endif
-
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
@@ -539,6 +535,7 @@ int main (argc, argv)
     ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
 #endif
 
+    exiting_signal = quiet ? SIGPIPE : 0;
     install_signal_handlers ();
 
     /* And get to work */
@@ -1780,8 +1777,6 @@ install_signal_handlers ()
   int nsigs = sizeof sig / sizeof sig[0];
   int i;
 
-  exiting_signal = quiet ? SIGPIPE : 0;
-
 #if SA_NOCLDSTOP
   struct sigaction act;
 
diff --git a/gzip.h b/gzip.h
index ae772e4d09d07f65bb796f863a2dc7155bc8d9dd..d7e7cc072d5cda81737d8754860099af5a1f7e6e 100644 (file)
--- a/gzip.h
+++ b/gzip.h
 #  define memzero(s, n)     bzero((s), (n))
 #endif
 
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
 #ifndef RETSIGTYPE
 #  define RETSIGTYPE void
 #endif
@@ -101,6 +105,10 @@ extern int method;         /* compression method */
 #  else
 #    define INBUFSIZ  0x8000  /* input buffer size */
 #  endif
+#  if defined SSIZE_MAX && SSIZE_MAX < INBUFSIZ
+#    undef INBUFSIZ
+#    define INBUFSIZ SSIZE_MAX
+#  endif
 #endif
 #define INBUF_EXTRA  64     /* required by unlzw() */
 
diff --git a/util.c b/util.c
index 7bad6589aca5f1c1f9d148a78d7562d9679dd907..32e24e7afc14ffdeba8ee7569851f68a3a242648 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,6 +1,7 @@
 /* util.c -- utility functions for gzip support
 
-   Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2001, 2002, 2006 Free Software
+   Foundation, Inc.
    Copyright (C) 1992-1993 Jean-loup Gailly
 
    This program is free software; you can redistribute it and/or modify
@@ -27,9 +28,6 @@ static char rcsid[] = "$Id$";
 
 #include "tailor.h"
 
-#ifdef HAVE_LIMITS_H
-#  include <limits.h>
-#endif
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
diff --git a/zip.c b/zip.c
index bb56478767017978219c60fa54baa2f9647d2b6a..4b2d538053cc852842de823cc8fe0da0d0b29cc2 100644 (file)
--- a/zip.c
+++ b/zip.c
@@ -28,6 +28,8 @@ static char rcsid[] = "$Id$";
 #include "gzip.h"
 #include "crypt.h"
 
+#include "timespec.h"
+
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif