LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[ipvsadm PATCH 1/2] ipvsadm: fix compile warning in print_largenum

To: lvs-devel@xxxxxxxxxxxxxxx, Daniel Borkmann <dborkman@xxxxxxxxxx>
Subject: [ipvsadm PATCH 1/2] ipvsadm: fix compile warning in print_largenum
Cc: Wensong Zhang <wensong@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, "Ryan O'Hara" <rohara@xxxxxxxxxx>, Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
From: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
Date: Thu, 04 Dec 2014 10:38:55 +0100
From: Daniel Borkmann <dborkman@xxxxxxxxxx>

ipvsadm.c: In function ‘print_largenum’:
ipvsadm.c:1445:3: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 2 has type ‘size_t’ [-Wformat=]
   printf("%*llu", len <= 8 ? 9 : len + 1, i);
   ^

Fix by reducing the scope and use int for len instead.

Signed-off-by: Daniel Borkmann <dborkman@xxxxxxxxxx>
Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
---
 ipvsadm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipvsadm.c b/ipvsadm.c
index 1190839..8931412 100644
--- a/ipvsadm.c
+++ b/ipvsadm.c
@@ -1437,15 +1437,15 @@ static inline char *fwd_switch(unsigned flags)
 
 static void print_largenum(unsigned long long i, unsigned int format)
 {
-       char mytmp[32];
-       size_t len;
-
        if (format & FMT_EXACT) {
+               char mytmp[32];
+               int len;
+
                len = snprintf(mytmp, 32, "%llu", i);
                printf("%*llu", len <= 8 ? 9 : len + 1, i);
                return;
        }
-       
+
        if (i < 100000000)                      /* less than 100 million */
                printf("%9llu", i);
        else if (i < 1000000000)                /* less than 1 billion */

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>