]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: Fix sending interface specific commands to manager process
authorRoy Marples <roy@marples.name>
Thu, 1 Sep 2022 19:48:40 +0000 (20:48 +0100)
committerRoy Marples <roy@marples.name>
Thu, 1 Sep 2022 19:48:40 +0000 (20:48 +0100)
Seems to have been broken for a while .... good to have this fixed.

src/dhcpcd.c

index 7a59d758c4fb20ae23b1611d9e809153dfba23d1..23a7f0a33af172964645703024b2686939eecdf3 100644 (file)
@@ -2119,6 +2119,14 @@ printpidfile:
                        snprintf(ctx.pidfile, sizeof(ctx.pidfile),
                            PIDFILE, "", "", "");
                        ctx.options |= DHCPCD_MANAGER;
+
+                       /*
+                        * If we are given any interfaces, we
+                        * cannot send a signal as that would impact
+                        * other interfaces.
+                        */
+                       if (optind != argc)
+                               sig = 0;
                }
                if (ctx.options & DHCPCD_PRINT_PIDFILE) {
                        printf("%s\n", ctx.pidfile);
@@ -2154,15 +2162,13 @@ printpidfile:
                if (pid != 0 && pid != -1)
                        loginfox("sending signal %s to pid %d", siga, pid);
                if (pid == 0 || pid == -1 || kill(pid, sig) != 0) {
-                       if (sig != SIGHUP && sig != SIGUSR1 && errno != EPERM)
-                               logerrx(PACKAGE" is not running");
                        if (pid != 0 && pid != -1 && errno != ESRCH) {
                                logerr("kill");
                                goto exit_failure;
                        }
                        unlink(ctx.pidfile);
-                       if (sig != SIGHUP && sig != SIGUSR1)
-                               goto exit_failure;
+                       /* We can still continue and send the command
+                        * via the control socket. */
                } else {
                        struct timespec ts;