diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-12 10:16:11 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-12 10:16:47 -0800 |
commit | 62e7af0326786a7dec91d982238948eddab9d6af (patch) | |
tree | 62f87db28e13c04dfa127ae7beccf108a5fefeb1 /tests/other-fs-tmpdir | |
parent | 380ab8453dbcfb4e17710a44148be4aa74f1b7dc (diff) | |
download | coreutils-62e7af0326786a7dec91d982238948eddab9d6af.tar.xz |
split: fix problems with /dev/zero
Problem reported by Nelson H.F. Beebe in: http://bugs.gnu.org/22624
Other problems also fixed: basically, the code got confused because
GNU/Linux reports that /dev/zero has size zero.
* src/split.c (input_file_size): Now takes struct stat *, not just
size. Always store the first buffer. All callers changed. Treat
/dev/zero as an infinitely-large file, both on GNU/Linux where
fstat and lseek say its size is zero, and on GNU/Hurd where they
say the size is OFF_T_MAX.
(cwrite): Return true on success.
(bytes_split): Don't try to read past EOF, and stop if a write fails.
(lines_rr): Omit stray check for ignorable errno.
(main): Get file size only when n_units > 1, since that's the only
time it is needed. Defer most of the work to input_file_size.
* tests/split/l-chunk.sh: Adjust tests to match new behavior
on oddball inputs.
Diffstat (limited to 'tests/other-fs-tmpdir')
0 files changed, 0 insertions, 0 deletions