From: Roy Marples Date: Thu, 30 Apr 2015 10:18:45 +0000 (+0000) Subject: Ensure errno is set if we dont find an interface. X-Git-Tag: v6.8.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d23770e2f9519d1b28ac4883dd2d33cfcdcd533b;p=thirdparty%2Fdhcpcd.git Ensure errno is set if we dont find an interface. --- 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; }