summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-04-12 00:21:25 +0200
committerJim Meyering <jim@meyering.net>2007-04-12 00:21:25 +0200
commit395fcee97a358fdfe2d6ca3bc2544cb008fd40f6 (patch)
treee967bcf7d0781bf5bc8e82e3864639f71dca79b2 /src
parentf839bfad730f49d162213fe313b47319bd74b9d3 (diff)
downloadcoreutils-395fcee97a358fdfe2d6ca3bc2544cb008fd40f6.tar.xz
split --line-bytes=N (-C N): don't create an empty file.
* src/split.c (line_bytes_split): Don't create an empty line afterwards if the last buffer happens to be exactly full. * tests/misc/split-fail: Add a test case for this. * NEWS: mention this.
Diffstat (limited to 'src')
-rw-r--r--src/split.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/split.c b/src/split.c
index 2fc6ecfcf..207cc13b3 100644
--- a/src/split.c
+++ b/src/split.c
@@ -336,7 +336,11 @@ line_bytes_split (size_t n_bytes)
n_buffered += n_read;
if (n_buffered != n_bytes)
- eof = true;
+ {
+ if (n_buffered == 0)
+ break;
+ eof = true;
+ }
/* Find where to end this chunk. */
bp = buf + n_buffered;