From 1a9db808992906eb599d9cdabec2e45de181fc1d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 1 Oct 2019 11:08:30 -0700 Subject: cmp: fix -l width bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/cmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cmp.c') 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)) -- cgit v1.2.1