From: Roy Marples Date: Sat, 14 Mar 2020 16:02:32 +0000 (+0000) Subject: privsep: Don't create DB directory in the real root as well. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=303500c5365369ce8b8baed73d401b17b85544d1;p=thirdparty%2Fdhcpcd.git privsep: Don't create DB directory in the real root as well. --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index d8c102bb..bf5d74c3 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -2028,9 +2028,6 @@ printpidfile: /* Ensure we have the needed directories */ if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST) logerr("%s: mkdir `%s'", __func__, RUNDIR); - if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST) - logerr("%s: mkdir `%s'", __func__, DBDIR); - if ((pid = pidfile_lock(ctx.pidfile)) != 0) { if (pid == -1) logerr("%s: pidfile_lock: %s", @@ -2112,6 +2109,13 @@ printpidfile: if_disable_rtadv(); #endif + /* 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 (ctx.options & DHCPCD_PRIVSEP && ps_start(&ctx) == -1) { logerr("ps_start");