diff options
| author | Roy Marples <roy@marples.name> | 2020-09-20 21:22:49 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-09-20 21:22:49 +0100 |
| commit | bda80910be831d41ea78d8a24db122e4b5732806 (patch) | |
| tree | 7feb0f88522e0f57c4c8048c94f38a1f096badce /src/dhcpcd.c | |
| parent | f6da2ec859a1beb492bc124498fc57b93ebd9809 (diff) | |
| download | dhcpcd-bda80910be831d41ea78d8a24db122e4b5732806.tar.xz | |
privsep: Don't remove pidfile at exit
The privileged actioneer will remove it.
Diffstat (limited to 'src/dhcpcd.c')
| -rw-r--r-- | src/dhcpcd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 228f7497..0c226129 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -2552,6 +2552,9 @@ exit1: #endif freeifaddrs(ifaddrs); } + /* ps_stop will clear DHCPCD_PRIVSEP but we need to + * remember it to avoid attemping to remove the pidfile */ + oi = ctx.options & DHCPCD_PRIVSEP ? 1 : 0; #ifdef PRIVSEP ps_stop(&ctx); #endif @@ -2600,14 +2603,14 @@ exit1: setproctitle_free(); #endif #ifdef USE_SIGNALS - if (ctx.options & DHCPCD_FORKED) - _exit(i); /* so atexit won't remove our pidfile */ - else if (ctx.options & DHCPCD_STARTED) { + if (ctx.options & DHCPCD_STARTED) { /* Try to detach from the launch process. */ if (ctx.fork_fd != -1 && write(ctx.fork_fd, &i, sizeof(i)) == -1) logerr("%s: write", __func__); } + if (ctx.options & DHCPCD_FORKED || oi != 0) + _exit(i); /* so atexit won't remove our pidfile */ #endif return i; } |
