From: Enrico Weigelt, metux IT service Date: Sun, 22 Feb 2009 19:09:11 +0000 (+0100) Subject: pmap_dump.c: protoname() now returning const char* X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=bcd5ff6093b13291d4ac886231456db78fd2b878;p=portmap.git pmap_dump.c: protoname() now returning const char* This fixes a compiler-warning on returning string constants as non-const char* --- diff --git a/pmap_dump.c b/pmap_dump.c index 333f41d..de078c3 100644 --- a/pmap_dump.c +++ b/pmap_dump.c @@ -17,7 +17,20 @@ #include #include -static char *protoname(u_long proto); +static const char *protoname(u_long proto) +{ + static char buf[BUFSIZ]; + + switch (proto) { + case IPPROTO_UDP: + return ("udp"); + case IPPROTO_TCP: + return ("tcp"); + default: + sprintf(buf, "%lu", proto); + return (buf); + } +} int main(int argc, char **argv) @@ -43,17 +56,3 @@ main(int argc, char **argv) return (fclose(stdout) ? (perror(argv[0]), 1) : 0); } -static char *protoname(u_long proto) -{ - static char buf[BUFSIZ]; - - switch (proto) { - case IPPROTO_UDP: - return ("udp"); - case IPPROTO_TCP: - return ("tcp"); - default: - sprintf(buf, "%lu", proto); - return (buf); - } -}