summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2015-04-30 10:18:45 +0000
committerRoy Marples <roy@marples.name>2015-04-30 10:18:45 +0000
commitd23770e2f9519d1b28ac4883dd2d33cfcdcd533b (patch)
tree8fd5986cad2a3523306c05385f69277cc5e9ebac /if.c
parent68729f15d95543e1e8bb2ee5fc6b432b4a94bb87 (diff)
downloaddhcpcd-d23770e2f9519d1b28ac4883dd2d33cfcdcd533b.tar.xz
Ensure errno is set if we dont find an interface.
Diffstat (limited to 'if.c')
-rw-r--r--if.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/if.c b/if.c
index b89a5cd9..e297c305 100644
--- a/if.c
+++ b/if.c
@@ -539,9 +539,10 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
static struct interface *
if_findindexname(struct if_head *ifaces, unsigned int idx, const char *name)
{
- struct interface *ifp;
if (ifaces != NULL) {
+ struct interface *ifp;
+
TAILQ_FOREACH(ifp, ifaces, next) {
if ((ifp->options == NULL ||
!(ifp->options->options & DHCPCD_PFXDLGONLY)) &&
@@ -553,6 +554,8 @@ if_findindexname(struct if_head *ifaces, unsigned int idx, const char *name)
return ifp;
}
}
+
+ errno = ESRCH;
return NULL;
}