net.c: Fix format string in stringify_port().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 1 Jan 2015 18:02:04 +0000 (18:02 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 11 Jan 2015 15:11:38 +0000 (16:11 +0100)
"port" is int, rather than unsigned. No biggy since at this point we
already know that port > 0.

Found by cppcheck.

net.c

diff --git a/net.c b/net.c
index dcadf54..aa3fcbb 100644 (file)
--- a/net.c
+++ b/net.c
@@ -208,7 +208,7 @@ const char *stringify_port(int port, const char *transport)
                struct servent *se = getservbyport(htons(port), transport);
 
                if (se == NULL)
-                       snprintf(service, sizeof(service), "%u", port);
+                       snprintf(service, sizeof(service), "%d", port);
                else
                        snprintf(service, sizeof(service), "%s", se->s_name);
        }