]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure that -M -x ifname does the right thing.
authorRoy Marples <roy@marples.name>
Tue, 11 Mar 2014 10:41:27 +0000 (10:41 +0000)
committerRoy Marples <roy@marples.name>
Tue, 11 Mar 2014 10:41:27 +0000 (10:41 +0000)
dhcpcd.c

index 2e3f2caf9865474827122f7b0335fe88d9d6ba84..8ccb89108ec50c16f528257588a027921d560648 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1196,6 +1196,9 @@ main(int argc, char **argv)
 
        ctx.argv = argv;
        ctx.argc = argc;
+       ctx.ifc = argc - optind;
+       ctx.ifv = argv + optind;
+
        ifo = read_config(&ctx, NULL, NULL, NULL);
        opt = add_options(&ctx, NULL, ifo, argc, argv);
        if (opt != 1) {
@@ -1278,7 +1281,9 @@ main(int argc, char **argv)
        }
 
 #ifdef USE_SIGNALS
-       if (!(ctx.options & (DHCPCD_MASTER | DHCPCD_TEST))) {
+       if (!(ctx.options & DHCPCD_TEST) &&
+           (sig == 0 || ctx.ifc != 0))
+       {
 #endif
                if (ctx.options & DHCPCD_MASTER)
                        i = -1;
@@ -1412,9 +1417,6 @@ main(int argc, char **argv)
        syslog(LOG_WARNING, "IPv4 subnet routes cannot be deleted");
 #endif
 
-       ctx.ifc = argc - optind;
-       ctx.ifv = argv + optind;
-
        /* When running dhcpcd against a single interface, we need to retain
         * the old behaviour of waiting for an IP address */
        if (ctx.ifc == 1 && !(ctx.options & DHCPCD_BACKGROUND))