summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2023-08-01 13:30:02 +0100
committerPádraig Brady <P@draigBrady.com>2023-08-01 13:30:02 +0100
commit89c8c5fff30af021433139c89de389ee4af7dfc5 (patch)
tree0ef71832968742b69d9047c5a49302021c5f5cc6
parentpinky: prefer signed types (diff)
downloadcoreutils-89c8c5fff30af021433139c89de389ee4af7dfc5.tar.gz
coreutils-89c8c5fff30af021433139c89de389ee4af7dfc5.zip
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.
-rw-r--r--src/ioblksize.h1
-rw-r--r--src/od.c4
2 files changed, 2 insertions, 3 deletions
diff --git a/src/ioblksize.h b/src/ioblksize.h
index 80d7931ba..0a2406286 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 7f5cfbb22..df7fe9eb8 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;
}