From: Roy Marples Date: Thu, 9 Jan 2020 15:59:15 +0000 (+0000) Subject: control: avoid unlinking the socket when sending commands X-Git-Tag: v9.0.0~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb4e29cb9f0087ac16a91abb5724f5f5537d6409;p=thirdparty%2Fdhcpcd.git control: avoid unlinking the socket when sending commands --- diff --git a/src/control.c b/src/control.c index c81d2cb3..eb43a935 100644 --- a/src/control.c +++ b/src/control.c @@ -269,6 +269,9 @@ control_stop(struct dhcpcd_ctx *ctx) int retval = 0; struct fd_list *l; + if (ctx->options & DHCPCD_FORKED) + return 0; + if (ctx->control_fd != -1) { eloop_event_delete(ctx->eloop, ctx->control_fd); close(ctx->control_fd); diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 13376b92..85af5494 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -1910,6 +1910,7 @@ printpidfile: !(ctx.options & DHCPCD_TEST)) { #endif + ctx.options |= DHCPCD_FORKED; /* avoid socket unlink */ if (!(ctx.options & DHCPCD_MASTER)) ctx.control_fd = control_open(argv[optind]); if (ctx.control_fd == -1) @@ -1928,6 +1929,7 @@ printpidfile: if (errno != ENOENT) logerr("%s: control_open", __func__); } + ctx.options &= ~DHCPCD_FORKED; #ifdef USE_SIGNALS } #endif