diff options
| author | Roy Marples <roy@marples.name> | 2020-11-11 17:44:55 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-11-11 17:44:55 +0000 |
| commit | 77260559dd3896fca1fc415ba57a01a71aedbc57 (patch) | |
| tree | d8baa56f5a44d1d5d32d59d57353db86e20a1691 /src/dhcpcd.c | |
| parent | 040561d61e157e7fb371f1311f0cee3536dee0d2 (diff) | |
| download | dhcpcd-77260559dd3896fca1fc415ba57a01a71aedbc57.tar.xz | |
dhcpcd: Don't create launcher process if keeping in foreground
There is little point.
Diffstat (limited to 'src/dhcpcd.c')
| -rw-r--r-- | src/dhcpcd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 7377fcc6..5892a28b 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -2244,6 +2244,9 @@ printpidfile: if (ctx.stdin_valid && freopen(_PATH_DEVNULL, "w", stdin) == NULL) logwarn("freopen stdin"); + if (!(ctx.options & DHCPCD_DAEMONISE)) + goto start_master; + #if defined(USE_SIGNALS) && !defined(THERE_IS_NO_FORK) if (xsocketpair(AF_UNIX, SOCK_DGRAM | SOCK_CXNB, 0, fork_fd) == -1 || (ctx.stderr_valid && @@ -2335,8 +2338,9 @@ printpidfile: /* We have now forked, setsid, forked once more. * From this point on, we are the controlling daemon. */ - ctx.options |= DHCPCD_STARTED; logdebugx("spawned master process on PID %d", getpid()); +start_master: + ctx.options |= DHCPCD_STARTED; if ((pid = pidfile_lock(ctx.pidfile)) != 0) { logerr("%s: pidfile_lock %d", __func__, pid); #ifdef PRIVSEP |
