diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-27 14:12:46 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-28 00:02:57 -0800 |
commit | 5ef892a9248e02dac13840f0acefe0fe72605dfa (patch) | |
tree | 1d5658a8d1f0db3b997d8d06e6edece44ef0e658 /zip.c | |
parent | 22aac8f8a616a72dbbe0e4119db8ddda0f076c04 (diff) | |
download | gzip-5ef892a9248e02dac13840f0acefe0fe72605dfa.tar.gz |
gzip: fdatasync output dir before unlinking
This follows up on the earlier patch to avoid data loss near
the system crashes. See: http://bugs.gnu.org/22768
* bootstrap.conf (gnulib_modules): Add dirname-lgpl, fdatasync,
openat-safer, unistd-safer, unlinkat.
* gzip.c: Include stddef.h, dirname.h.
Include fcntl--.h instead of fcntl-safer.h.
(RW_USER): Remove; no longer needed.
(dfname, dfd): New static vars.
(dot): New static const.
(atdir_eq, atdir_set): New functions.
(treat_file): Also fdatasync the output directory, if !keep.
(treat_file, create_outfile, open_and_stat):
Use dir fd for unlinkat and openat, if possible.
(open_and_stat): Omit mode argument, since it was always the
same. All callers changed.
* lib/.gitignore, m4/.gitignore: Add new gnulib files.
* tailor.h (PROTO, NO_STDIN_FSTAT, OPEN): Remove. Remove MACOS
section, as this stuff would not work anyway now, and circa 2001
Apple stopped supporting Mac OS 9 and earlier.
* zip.c: Do not include unistd.h and fcntl.h, as this file does
not directly use any symbols defined by those headers.
Diffstat (limited to 'zip.c')
-rw-r--r-- | zip.c | 3 |
1 files changed, 0 insertions, 3 deletions
@@ -23,9 +23,6 @@ #include "tailor.h" #include "gzip.h" -#include <unistd.h> -#include <fcntl.h> - local ulg crc; /* crc on uncompressed file data */ off_t header_bytes; /* number of bytes in gzip header */ |