diff mbox

gard: Fix printf warning

Message ID 20161031053350.24315-1-joel@jms.id.au
State Accepted
Headers show

Commit Message

Joel Stanley Oct. 31, 2016, 5:33 a.m. UTC
With a modern GCC targetting ARM 32-bit:

 gard.c: In function 'main':
 gard.c:652:19: error: format '%lu' expects argument of type 'long
 unsigned int', but argument 4 has type 'uint64_t {aka long long
 unsigned int}' [-Werror=format=]
    fprintf(stderr, "MTD device bigger than %i: size:%lu\n",

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 external/gard/gard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stewart Smith Nov. 2, 2016, 5:34 a.m. UTC | #1
Joel Stanley <joel@jms.id.au> writes:
> With a modern GCC targetting ARM 32-bit:
>
>  gard.c: In function 'main':
>  gard.c:652:19: error: format '%lu' expects argument of type 'long
>  unsigned int', but argument 4 has type 'uint64_t {aka long long
>  unsigned int}' [-Werror=format=]
>     fprintf(stderr, "MTD device bigger than %i: size:%lu\n",
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Thanks! Merged to master as of ed9c11c90d30484072a3d39d8b6660992699198e
diff mbox

Patch

diff --git a/external/gard/gard.c b/external/gard/gard.c
index 7ec52d80db40..4b26a3b8876d 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -24,6 +24,7 @@ 
 #include <sys/stat.h>
 #include <dirent.h>
 #include <limits.h>
+#include <inttypes.h>
 
 #include <ccan/array_size/array_size.h>
 
@@ -649,7 +650,7 @@  int main(int argc, char **argv)
 		goto out;
 
 	if (bl_size > UINT_MAX) {
-		fprintf(stderr, "MTD device bigger than %i: size:%lu\n",
+		fprintf(stderr, "MTD device bigger than %i: size: %" PRIu64 "\n",
 			UINT_MAX, bl_size);
 		rc = EXIT_FAILURE;
 		goto out;