diff mbox

[iproute2,1/3] tc: fix compilation warning on 32bits arch

Message ID 1429632397-11122-1-git-send-email-nicolas.dichtel@6wind.com
State Changes Requested, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nicolas Dichtel April 21, 2015, 4:06 p.m. UTC
The warning was:
m_simple.c: In function ‘parse_simple’:
m_simple.c:142:4: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’ [-Wformat]

Useful to be able to compile with -Werror.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 tc/m_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Laight April 21, 2015, 4:22 p.m. UTC | #1
From: Nicolas Dichtel

> Sent: 21 April 2015 17:07

> The warning was:

> m_simple.c: In function parse_simple:

> m_simple.c:142:4: warning: format %ld expects argument of type long int, but argument 3 has type

> size_t [-Wformat]

> 

> Useful to be able to compile with -Werror.

> 

> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

> ---

>  tc/m_simple.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/tc/m_simple.c b/tc/m_simple.c

> index 866552f559b3..3b6d7beb769c 100644

> --- a/tc/m_simple.c

> +++ b/tc/m_simple.c

> @@ -139,7 +139,7 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,

> 

>  	if (strlen(simpdata) > (SIMP_MAX_DATA - 1)) {

>  		fprintf(stderr, "simple: Illegal string len %ld <%s> \n",

> -			strlen(simpdata), simpdata);

> +			(long)strlen(simpdata), simpdata);

>  		return -1;


Isn't the correct fix to use "%zu" ?

	David
diff mbox

Patch

diff --git a/tc/m_simple.c b/tc/m_simple.c
index 866552f559b3..3b6d7beb769c 100644
--- a/tc/m_simple.c
+++ b/tc/m_simple.c
@@ -139,7 +139,7 @@  parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
 
 	if (strlen(simpdata) > (SIMP_MAX_DATA - 1)) {
 		fprintf(stderr, "simple: Illegal string len %ld <%s> \n",
-			strlen(simpdata), simpdata);
+			(long)strlen(simpdata), simpdata);
 		return -1;
 	}