changeset 5402:63820c0792bc draft

dhcpcd: Fix creating DBDIR As privsep now uses files in / and not the dhcpcd users directory we need to ensure the mkdir is back with the rundir.
author Roy Marples <roy@marples.name>
date Fri, 03 Jul 2020 11:30:25 +0100
parents 1af97ed9fd4a
children f69a4030b5a6
files src/dhcpcd.c
diffstat 1 files changed, 2 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Thu Jul 02 18:14:01 2020 +0100
+++ b/src/dhcpcd.c	Fri Jul 03 11:30:25 2020 +0100
@@ -2186,6 +2186,8 @@
 
 	if (!(ctx.options & DHCPCD_TEST)) {
 		/* Ensure we have the needed directories */
+		if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST)
+			logerr("%s: mkdir `%s'", __func__, DBDIR);
 		if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST)
 			logerr("%s: mkdir `%s'", __func__, RUNDIR);
 		if ((pid = pidfile_lock(ctx.pidfile)) != 0) {
@@ -2284,13 +2286,6 @@
 		}
 	}
 
-	/* If we're not running in privsep, we need to create the DB
-	 * directory here. */
-	if (!(ctx.options & DHCPCD_PRIVSEP)) {
-		if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST)
-			logerr("%s: mkdir `%s'", __func__, DBDIR);
-	}
-
 #ifdef PRIVSEP
 	if (IN_PRIVSEP(&ctx) && ps_start(&ctx) == -1) {
 		logerr("ps_start");