diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/split.c | 4 |
2 files changed, 6 insertions, 1 deletions
@@ -19,6 +19,9 @@ GNU coreutils NEWS -*- outline -*- was particularly easy to trigger, since there, the removal of D could precede the initial stat. [This bug was present in "the beginning".] + split --number=C /dev/null no longer appears to infloop on GNU/Hurd + [bug introduced in coreutils-8.8] + ** New features fmt now accepts the --goal=WIDTH (-g) option. diff --git a/src/split.c b/src/split.c index 99f639016..062aedea9 100644 --- a/src/split.c +++ b/src/split.c @@ -1339,7 +1339,9 @@ main (int argc, char **argv) error (EXIT_FAILURE, errno, "%s", infile); if (in_blk_size == 0) in_blk_size = io_blksize (stat_buf); - file_size = stat_buf.st_size; + + /* stat.st_size is valid only for regular files. For others, use 0. */ + file_size = S_ISREG (stat_buf.st_mode) ? stat_buf.st_size : 0; if (split_type == type_chunk_bytes || split_type == type_chunk_lines) { |