From 1e7e3769dc4efd55249c475470152acbcf804bb3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 9 Dec 2006 01:19:52 +0000 Subject: [PATCH] Fix problems in porting to NSK reported by Matthew Woehlke in and . * gzip.h: Include , for SSIZE_MAX. (INBUFSIZE): Don't make it any larger than SSIZE_MAX. Problem reported by Matthew Woehlke in . * gzip.c: Don't include , 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 | 16 ++++++++++++++++ gzip.c | 7 +------ gzip.h | 8 ++++++++ util.c | 6 ++---- zip.c | 2 ++ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bfb01c..7ebeca9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-12-08 Paul Eggert + + Fix problems in porting to NSK reported by Matthew Woehlke in + and + . + * gzip.h: Include , for SSIZE_MAX. + (INBUFSIZE): Don't make it any larger than SSIZE_MAX. + Problem reported by Matthew Woehlke in + . + * gzip.c: Don't include , 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 (tiny change) * gzexe.in: Work around FreeBSD shell trap bug. diff --git a/gzip.c b/gzip.c index 7e17497..d1aeb78 100644 --- a/gzip.c +++ b/gzip.c @@ -85,10 +85,6 @@ static char rcsid[] = "$Id$"; # include #endif -#ifdef HAVE_LIMITS_H -# include -#endif - #ifdef HAVE_UNISTD_H # include #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 ae772e4..d7e7cc0 100644 --- a/gzip.h +++ b/gzip.h @@ -59,6 +59,10 @@ # define memzero(s, n) bzero((s), (n)) #endif +#ifdef HAVE_LIMITS_H +# include +#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 7bad658..32e24e7 100644 --- 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 -#endif #ifdef HAVE_UNISTD_H # include #endif diff --git a/zip.c b/zip.c index bb56478..4b2d538 100644 --- 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 #endif -- 2.47.2