From: Jim Meyering Date: Sun, 16 Aug 2009 09:39:07 +0000 (+0200) Subject: avoid silent data loss e.g., on NFS, due to unchecked close of stdout X-Git-Tag: v1.3.13~27 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3fe0caeada6aa3abca87b5099594bd87e5dfccfe;p=debian%2Fgzip avoid silent data loss e.g., on NFS, due to unchecked close of stdout * gzip.c: Include "closein.h". (main): Use atexit (close_stdin); * bootstrap.conf (gnulib_modules): Add closein. Prompted by Mark Kidwell's report and patch in http://bugs.debian.org/538187 * NEWS (Bug fixes): Mention it. * */.gitignore: Update. --- diff --git a/NEWS b/NEWS index 90c2e61..0e6918d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ GNU gzip NEWS -*- outline -*- ** Bug fixes + gzip no longer ignores a close-induced write failure, e.g., on NFS + Major changes in Gzip 1.3.12 (2007-04-13) diff --git a/bootstrap.conf b/bootstrap.conf index a617bd7..7bc8ab6 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -23,6 +23,7 @@ IMPORT_FROM_GETTEXT=no # gnulib modules used by this package. gnulib_modules=' + closein fcntl fcntl-safer fdl diff --git a/gzip.c b/gzip.c index b8916c1..71e0674 100644 --- a/gzip.c +++ b/gzip.c @@ -64,6 +64,7 @@ static char rcsid[] = "$Id$"; #include #include +#include "closein.h" #include "tailor.h" #include "gzip.h" #include "lzw.h" @@ -417,6 +418,8 @@ int main (argc, argv) program_name = gzip_base_name (argv[0]); proglen = strlen (program_name); + atexit (close_stdin); + /* Suppress .exe for MSDOS, OS/2 and VMS: */ if (4 < proglen && strequ (program_name + proglen - 4, ".exe")) program_name[proglen - 4] = '\0'; diff --git a/lib/.gitignore b/lib/.gitignore index 27d515c..fc5cb87 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,6 +1,13 @@ .deps Makefile Makefile.in +close-stream.c +close-stream.h +closein.c +closein.h +closeout.c +closeout.h +config.charset config.h config.hin creat-safer.c @@ -15,6 +22,16 @@ fcntl-safer.h fcntl.h fcntl.in.h fd-safer.c +fflush.c +fpending.c +fpending.h +fpurge.c +freadahead.c +freadahead.h +freading.c +freading.h +fseeko.c +ftello.c getopt.c getopt.in.h getopt1.c @@ -23,16 +40,29 @@ gettext.h gnulib.mk intprops.h libgzip.a +localcharset.c +localcharset.h +lseek.c +mbrtowc.c +mbsinit.c open-safer.c open.c pipe-safer.c +quotearg.c +quotearg.h +ref-add.sin +ref-del.sin stamp-h1 stat-time.h stdbool.in.h stddef.in.h stdint.in.h +stdio-impl.h +stdio-write.c +stdio.in.h stdlib.h stdlib.in.h +streq.h strerror.c string.h string.in.h @@ -47,7 +77,9 @@ unistd.h unistd.in.h utimens.c utimens.h +verify.h wchar.in.h +wctype.in.h xalloc-die.c xalloc.h xmalloc.c diff --git a/m4/.gitignore b/m4/.gitignore index 59a68c6..e2e2d82 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -1,11 +1,22 @@ 00gnulib.m4 +close-stream.m4 +closein.m4 +closeout.m4 +codeset.m4 errno_h.m4 error.m4 exitfail.m4 extensions.m4 fcntl-safer.m4 fcntl_h.m4 +fflush.m4 +fpending.m4 +fpurge.m4 +freading.m4 +fseeko.m4 +ftello.m4 getopt.m4 +glibc21.m4 gnu-make.m4 gnulib-cache.m4 gnulib-common.m4 @@ -13,14 +24,24 @@ gnulib-comp.m4 gnulib-tool.m4 include_next.m4 inline.m4 +localcharset.m4 +locale-fr.m4 +locale-ja.m4 +locale-zh.m4 longlong.m4 +lseek.m4 +mbrtowc.m4 +mbsinit.m4 +mbstate_t.m4 mode_t.m4 multiarch.m4 open.m4 +quotearg.m4 stat-time.m4 stdbool.m4 stddef_h.m4 stdint.m4 +stdio_h.m4 stdlib_h.m4 strerror.m4 string_h.m4 @@ -34,6 +55,7 @@ utimens.m4 utimes.m4 wchar.m4 wchar_t.m4 +wctype.m4 wint_t.m4 xalloc.m4 yesno.m4