changeset 4954:52e1039652ea draft

privsep: Fix prior so we init
author Roy Marples <roy@marples.name>
date Thu, 09 Jan 2020 15:52:41 +0000
parents 109206a59cc6
children 5e8f2a4504e7
files src/privsep.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/privsep.c	Thu Jan 09 15:39:18 2020 +0000
+++ b/src/privsep.c	Thu Jan 09 15:52:41 2020 +0000
@@ -94,6 +94,8 @@
 		logerr("chown `%s'", DBDIR);
 	if (chown(RUNDIR, pw->pw_uid, gid) == -1)
 		logerr("chown `%s'", RUNDIR);
+
+	ctx->options |= DHCPCD_PRIVSEP;
 	return 0;
 }
 
@@ -142,7 +144,6 @@
 		*priv_pid = pid;
 		*priv_fd = fd[0];
 		close(fd[1]);
-		ctx->options |= DHCPCD_PRIVSEP;
 		if (recv_unpriv_msg != NULL &&
 		    eloop_event_add(ctx->eloop, *priv_fd,
 		    recv_unpriv_msg, recv_ctx) == -1)
@@ -153,7 +154,7 @@
 		return pid;
 	}
 
-	ctx->options |= DHCPCD_PRIVSEP | DHCPCD_UNPRIV | DHCPCD_FORKED;
+	ctx->options |= DHCPCD_UNPRIV | DHCPCD_FORKED;
 	if (ctx->fork_fd != -1) {
 		close(ctx->fork_fd);
 		ctx->fork_fd = -1;