diff options
author | Pádraig Brady <P@draigBrady.com> | 2010-11-07 03:09:38 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2010-11-16 00:50:09 +0000 |
commit | 9ad13ad14ac50b7b7fe57ff3265494b38e15281c (patch) | |
tree | 032d43da929061b70e023f1d75b347d1426a2635 /src | |
parent | c8d570c2b31166d0792d64635674df5b2d543d12 (diff) | |
download | coreutils-9ad13ad14ac50b7b7fe57ff3265494b38e15281c.tar.gz coreutils-9ad13ad14ac50b7b7fe57ff3265494b38e15281c.tar.bz2 coreutils-9ad13ad14ac50b7b7fe57ff3265494b38e15281c.zip |
split: fail immediately if impossible to create a large file
* src/split.c (main): Error if -[bC] value > OFF_T_MAX
* tests/misc/split-fail: Adjust for the new lower limits
Diffstat (limited to 'src')
-rw-r--r-- | src/split.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/split.c b/src/split.c index 61ae265d8..a391ecc12 100644 --- a/src/split.c +++ b/src/split.c @@ -432,6 +432,13 @@ main (int argc, char **argv) error (0, 0, _("%s: invalid number of bytes"), optarg); usage (EXIT_FAILURE); } + /* If input is a pipe, we could get more data than is possible + to write to a single file, so indicate that immediately + rather than having possibly future invocations fail. */ + if (OFF_T_MAX < n_units) + error (EXIT_FAILURE, EFBIG, + _("%s: invalid number of bytes"), optarg); + break; case 'l': @@ -456,6 +463,9 @@ main (int argc, char **argv) error (0, 0, _("%s: invalid number of bytes"), optarg); usage (EXIT_FAILURE); } + if (OFF_T_MAX < n_units) + error (EXIT_FAILURE, EFBIG, + _("%s: invalid number of bytes"), optarg); break; case '0': |