commit 9625b836b2f59393dcecad714ecd85d7dc7b85f3 parent 92c848c446c20bd86b2e4e4d15cb8adefd46420d Author: sin <sin@2f30.org> Date: Fri, 29 Jul 2016 12:21:56 +0100 Merge more conditionals Diffstat:
M | sbm.c | | | 16 | +++++++--------- |
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/sbm.c b/sbm.c @@ -46,16 +46,14 @@ scan(char *ifname) } } else { for (ifa = ifas; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_flags & IFF_LOOPBACK) + if (ifa->ifa_flags & IFF_LOOPBACK || + !(ifa->ifa_flags & IFF_UP) || + !(ifa->ifa_flags & IFF_RUNNING)) continue; - if (ifa->ifa_flags & IFF_RUNNING) { - if (ifa->ifa_flags & IFF_UP) { - strncpy(ifname, ifa->ifa_name, IF_NAMESIZE); - ifname[IF_NAMESIZE - 1] = '\0'; - found = 1; - break; - } - } + strncpy(ifname, ifa->ifa_name, IF_NAMESIZE); + ifname[IF_NAMESIZE - 1] = '\0'; + found = 1; + break; } } freeifaddrs(ifas);