cmp: fix -l width bug

Problem reported by Dave Odell (Bug#37558).
* src/cmp.c (cmp): Treat negative ‘bytes’ as infinite, fixing a
bug introduced in the 2019-08-27 patch that fixed Bug#35256.
This commit is contained in:
Paul Eggert 2019-10-01 11:08:30 -07:00
parent 8d26b1403e
commit 1a9db80899

View File

@ -394,7 +394,8 @@ cmp (void)
if (comparison_type == type_all_diffs)
{
off_t byte_number_max = MIN (bytes, TYPE_MAXIMUM (off_t));
off_t byte_number_max = (0 <= bytes && bytes <= TYPE_MAXIMUM (off_t)
? bytes : TYPE_MAXIMUM (off_t));
for (f = 0; f < 2; f++)
if (S_ISREG (stat_buf[f].st_mode))