diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-06 11:13:22 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-06 11:13:22 +0100 |
commit | c73cf48ae4ec3589b07e4b6a39ada2a2bb67de08 (patch) | |
tree | 0c03ecc4e7aaedf9d04e89745983955712401ff9 | |
parent | 9a23f1859e8b54070da3455230d4785542b7d260 (diff) | |
download | pingu-c73cf48ae4ec3589b07e4b6a39ada2a2bb67de08.tar.bz2 pingu-c73cf48ae4ec3589b07e4b6a39ada2a2bb67de08.tar.xz |
pingu_netlink: logging cleanup
Fixes uninitialized wraning in valgrind.
-rw-r--r-- | pingu_netlink.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pingu_netlink.c b/pingu_netlink.c index 9f923f8..0c0ff0e 100644 --- a/pingu_netlink.c +++ b/pingu_netlink.c @@ -644,18 +644,20 @@ static void log_route_change(struct pingu_route *route, int table, int action) { char deststr[64] = "", gwstr[64] = "", viastr[68] = ""; - char ifname[IF_NAMESIZE]; + char ifname[IF_NAMESIZE] = ""; + char devstr[IF_NAMESIZE + 5] = ""; char *actionstr = "New"; if (action == RTM_DELROUTE) actionstr = "Delete"; - if_indextoname(route->dev_index, ifname); + if (if_indextoname(route->dev_index, ifname) != NULL) + snprintf(devstr, sizeof(devstr), "dev %s ", ifname); sockaddr_to_string(&route->dest, deststr, sizeof(deststr)); sockaddr_to_string(&route->gw_addr, gwstr, sizeof(gwstr)); if (gwstr[0] != '\0') snprintf(viastr, sizeof(viastr), "via %s ", gwstr); - log_info("%s route to %s/%i %sdev %s table %i", actionstr, - deststr, route->dst_len, viastr, ifname, table); + log_info("%s route to %s/%i %s%stable %i", actionstr, + deststr, route->dst_len, viastr, devstr, table); } void route_changed_for_iface(struct pingu_iface *iface, |