From 89c8c5fff30af021433139c89de389ee4af7dfc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Tue, 1 Aug 2023 13:30:02 +0100 Subject: [PATCH] od: fix issues with recent format string changes * src/ioblksize.h: Avoid syntax check with redundant idx.h inclusion. * src/od.c (FMT_BYTES_ALLOCATED): Increase by two to avoid: error: '%s' directive writing between 1 and 2 bytes into a region of size between 1 and 4 [-Werror=format-overflow=] (maint): Use %td to print idx_t rather than invalid %jt format. --- src/ioblksize.h | 1 - src/od.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ioblksize.h b/src/ioblksize.h index 80d7931ba8..0a24062866 100644 --- a/src/ioblksize.h +++ b/src/ioblksize.h @@ -17,7 +17,6 @@ /* Include this file _after_ system headers if possible. */ /* sys/stat.h and minmax.h will already have been included by system.h. */ -#include "idx.h" #include "count-leading-zeros.h" #include "stat-size.h" diff --git a/src/od.c b/src/od.c index 7f5cfbb22b..df7fe9eb86 100644 --- a/src/od.c +++ b/src/od.c @@ -84,7 +84,7 @@ enum output_format enum { FMT_BYTES_ALLOCATED = - (sizeof "%*.99" - 1 + (sizeof "%*.99" + 1 + MAX (sizeof "ld", MAX (sizeof PRIdMAX, MAX (sizeof PRIoMAX, @@ -1927,7 +1927,7 @@ main (int argc, char **argv) bytes_per_block = desired_width; else { - error (0, 0, _("warning: invalid width %jt; using %d instead"), + error (0, 0, _("warning: invalid width %td; using %d instead"), desired_width, l_c_m); bytes_per_block = l_c_m; } -- 2.47.3