From: Roy Marples Date: Thu, 14 Aug 2008 16:15:45 +0000 (+0000) Subject: If a device is not found, report it. X-Git-Tag: v4.0.2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb8a5f981735c7c6a85a9f996cc4bcd39f48e34a;p=thirdparty%2Fdhcpcd.git If a device is not found, report it. --- diff --git a/net.c b/net.c index abad3059..8217aa81 100644 --- a/net.c +++ b/net.c @@ -183,7 +183,7 @@ do_interface(const char *ifname, { int s; struct ifconf ifc; - int retval = 0; + int retval = 0, found = 0; int len = 10 * sizeof(struct ifreq); int lastlen = 0; char *p; @@ -240,6 +240,8 @@ do_interface(const char *ifname, if (strcmp(ifname, ifr->ifr_name) != 0) continue; + found = 1; + #ifdef AF_LINK if (hwaddr && hwlen && ifr->ifr_addr.sa_family == AF_LINK) { sdl = xmalloc(ifr->ifr_addr.sa_len); @@ -275,6 +277,8 @@ do_interface(const char *ifname, } + if (!found) + errno = ENXIO; close(s); free(ifc.ifc_buf); return retval;