From 05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 18 Mar 2010 10:10:32 +0100 Subject: Fix lots of warnings, most around string literals... ...that were converted to char* when they should have been converted to const char *. Use braces for empty if/else statements. --- interface.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'interface.c') diff --git a/interface.c b/interface.c index 0b0d5791..86332300 100644 --- a/interface.c +++ b/interface.c @@ -74,7 +74,7 @@ struct interface_pair_s { #ifdef linux #define have_interface_init -static char *netdevfmt; +static const char *netdevfmt; void interface_init(void) /* figure out which /proc/net/dev format to use */ @@ -173,13 +173,13 @@ static int get_ifinfo(const char *ifname, ifinfo_t *ifinfo) result = FALSE; else { - char *sp = strchr(ifname, '/'); + char *tmp = xstrdup(ifname); + char *sp = strchr(tmp, '/'); /* hide slash and trailing info from ifname */ if (sp) *sp = '\0'; result = _get_ifinfoGT_(socket_fd, stats_file, ifname, ifinfo); - if (sp) - *sp = '/'; + free(tmp); } if (socket_fd >= 0) SockClose(socket_fd); @@ -579,6 +579,7 @@ void interface_parse(char *buf, struct hostdata *hp) /* parse 'interface' specification */ { char *cp1, *cp2; + char mask1[] = "255.255.255.255"; hp->interface = xstrdup(buf); @@ -593,7 +594,7 @@ void interface_parse(char *buf, struct hostdata *hp) /* find and isolate just the netmask */ if (!(cp2 = strchr(cp1, '/'))) - cp2 = "255.255.255.255"; + cp2 = mask1; else *cp2++ = '\000'; -- cgit v1.2.3