coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dd: fix a printf format mismatch in an error message


From: Pádraig Brady
Subject: [PATCH] dd: fix a printf format mismatch in an error message
Date: Thu, 20 Dec 2012 00:17:44 +0000

* src/dd.c (dd_copy): To print an off_t portably we need
to use PRIdMAX and cast to intmax_t, otherwise there
could be a mismatch between say a 32 bit off_t
and uintmax_t.  This was flagged by -Wformat on
a 64 bit host when compiling with CFLAGS=-m32.
---
 src/dd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/dd.c b/src/dd.c
index b613fcf..4e35df0 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -2130,9 +2130,9 @@ dd_copy (void)
               if (ftruncate (STDOUT_FILENO, output_offset) != 0)
                 {
                   error (0, errno,
-                         _("failed to truncate to %"PRIuMAX" bytes"
+                         _("failed to truncate to %" PRIdMAX " bytes"
                            " in output file %s"),
-                         output_offset, quote (output_file));
+                         (intmax_t) output_offset, quote (output_file));
                   return EXIT_FAILURE;
                 }
             }
-- 
1.7.6.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]