From: Guus Sliepen Date: Sun, 9 Oct 2016 13:09:52 +0000 (+0200) Subject: Fix possibly unitialized variable. X-Git-Tag: release-1.0.29~2 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=6714a74b30e1cbf9fe45b14c00d0ebebf8f26c4c;p=tinc Fix possibly unitialized variable. --- diff --git a/src/bsd/device.c b/src/bsd/device.c index 46879e46..95e65f9c 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -198,18 +198,19 @@ static bool setup_device(void) { // Guess what the corresponding interface is called - char *realname; + char *realname = NULL; #if defined(HAVE_FDEVNAME) - realname = fdevname(device_fd) ? : device; + realname = fdevname(device_fd); #elif defined(HAVE_DEVNAME) struct stat buf; if(!fstat(device_fd, &buf)) - realname = devname(buf.st_rdev, S_IFCHR) ? : device; -#else - realname = device; + realname = devname(buf.st_rdev, S_IFCHR); #endif + if(!realname) + realname = device; + if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) iface = xstrdup(strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname); else if(strcmp(iface, strrchr(realname, '/') ? strrchr(realname, '/') + 1 : realname))