summaryrefslogtreecommitdiffstats
path: root/net.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-08-14 16:15:45 +0000
committerRoy Marples <roy@marples.name>2008-08-14 16:15:45 +0000
commitfb8a5f981735c7c6a85a9f996cc4bcd39f48e34a (patch)
treeb05b59b98d2946f2bf989747e6c792e67cc57edf /net.c
parent50b9957e82beba942dffd8574fe937597ddb1fe6 (diff)
downloaddhcpcd-fb8a5f981735c7c6a85a9f996cc4bcd39f48e34a.tar.xz
If a device is not found, report it.
Diffstat (limited to 'net.c')
-rw-r--r--net.c6
1 files changed, 5 insertions, 1 deletions
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;