summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-10-01 11:08:30 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-10-01 11:15:38 -0700
commit1a9db808992906eb599d9cdabec2e45de181fc1d (patch)
tree371a0a78c676cbe7b69a1b70bac70b3130d6be5b /src
parent8d26b1403e8607811ccebdfe2822f2dad42a36d3 (diff)
downloaddiffutils-1a9db808992906eb599d9cdabec2e45de181fc1d.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/cmp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmp.c b/src/cmp.c
index 16e8869..5152ca0 100644
--- a/src/cmp.c
+++ b/src/cmp.c
@@ -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))