diff options
Diffstat (limited to 'src/split.c')
-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': |