summaryrefslogtreecommitdiffstats
path: root/src/privsep-inet.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-08-20 16:28:47 +0100
committerRoy Marples <roy@marples.name>2020-08-20 16:28:47 +0100
commit2d18b2a25e2e95595ff7b643d2a2754540549e3d (patch)
tree736348035fa69ab8f98a919aedd8185728fcd659 /src/privsep-inet.c
parent684895a84c40b4484c7e0d7ce555f7154d8e6d22 (diff)
downloaddhcpcd-2d18b2a25e2e95595ff7b643d2a2754540549e3d.tar.xz
privsep: Only the master process accepts signals
The master process dictates when processes should stop, which allows for a clean shutdown when the admin issues `pkill dhcpcd`.
Diffstat (limited to 'src/privsep-inet.c')
-rw-r--r--src/privsep-inet.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/privsep-inet.c b/src/privsep-inet.c
index 8bc0c2ea..89ba79e0 100644
--- a/src/privsep-inet.c
+++ b/src/privsep-inet.c
@@ -34,7 +34,6 @@
#include <assert.h>
#include <errno.h>
-#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -291,18 +290,6 @@ ps_inet_recvmsg(void *arg)
logerr(__func__);
}
-static void
-ps_inet_signalcb(int sig, void *arg)
-{
- struct dhcpcd_ctx *ctx = arg;
-
- if (sig != SIGTERM)
- return;
-
- shutdown(ctx->ps_inet_fd, SHUT_RDWR);
- eloop_exit(ctx->eloop, EXIT_SUCCESS);
-}
-
ssize_t
ps_inet_dispatch(void *arg, struct ps_msghdr *psm, struct msghdr *msg)
{
@@ -347,7 +334,7 @@ ps_inet_start(struct dhcpcd_ctx *ctx)
pid = ps_dostart(ctx, &ctx->ps_inet_pid, &ctx->ps_inet_fd,
ps_inet_recvmsg, ps_inet_dodispatch, ctx,
- ps_inet_startcb, ps_inet_signalcb,
+ ps_inet_startcb, NULL,
PSF_DROPPRIVS);
#ifdef HAVE_CAPSICUM
@@ -576,7 +563,7 @@ ps_inet_cmd(struct dhcpcd_ctx *ctx, struct ps_msghdr *psm, struct msghdr *msg)
start = ps_dostart(ctx,
&psp->psp_pid, &psp->psp_fd,
ps_inet_recvmsgpsp, NULL, psp,
- start_func, ps_inet_signalcb,
+ start_func, NULL,
PSF_DROPPRIVS);
switch (start) {
case -1: