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':
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':
split -0 in 2> /dev/null && fail=1
split --lines=$UINTMAX_MAX in || fail=1
-split --bytes=$UINTMAX_MAX in || fail=1
+split --bytes=$OFF_T_MAX in || fail=1
+split --line-bytes=$OFF_T_OFLOW 2> /dev/null in && fail=1
split --line-bytes=$SIZE_OFLOW 2> /dev/null in && fail=1
# Make sure that a huge obsolete option evokes the right failure.