changeset 4955:5e8f2a4504e7 draft

control: avoid unlinking the socket when sending commands
author Roy Marples <roy@marples.name>
date Thu, 09 Jan 2020 15:59:15 +0000
parents 52e1039652ea
children 51ee8eedecfa
files src/control.c src/dhcpcd.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/control.c	Thu Jan 09 15:52:41 2020 +0000
+++ b/src/control.c	Thu Jan 09 15:59:15 2020 +0000
@@ -269,6 +269,9 @@
 	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);
--- a/src/dhcpcd.c	Thu Jan 09 15:52:41 2020 +0000
+++ b/src/dhcpcd.c	Thu Jan 09 15:59:15 2020 +0000
@@ -1910,6 +1910,7 @@
 	    !(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 @@
 			if (errno != ENOENT)
 				logerr("%s: control_open", __func__);
 		}
+		ctx.options &= ~DHCPCD_FORKED;
 #ifdef USE_SIGNALS
 	}
 #endif