]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure errno is set if we dont find an interface.
authorRoy Marples <roy@marples.name>
Thu, 30 Apr 2015 10:18:45 +0000 (10:18 +0000)
committerRoy Marples <roy@marples.name>
Thu, 30 Apr 2015 10:18:45 +0000 (10:18 +0000)
if.c

diff --git a/if.c b/if.c
index b89a5cd9ef4b188906c9679c33aa3acd3a5a841e..e297c305f0c9cea091a44395d89f45fcaf79f62b 100644 (file)
--- 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;
 }