aboutsummaryrefslogtreecommitdiffstats
path: root/interface.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2010-03-18 10:10:32 +0100
committerMatthias Andree <matthias.andree@gmx.de>2010-03-18 10:10:32 +0100
commit05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4 (patch)
tree898185b02c06b47450c88fc8731cf508c056568d /interface.c
parente9c99cb0a353ed18bd7c6ea6e93ec2fea326bbb4 (diff)
downloadfetchmail-05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4.tar.gz
fetchmail-05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4.tar.bz2
fetchmail-05cb2b9c62b323a1278c81b6cbe00b2e4186b4f4.zip
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.
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c11
1 files changed, 6 insertions, 5 deletions
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';