]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Don't create DB directory in the real root as well.
authorRoy Marples <roy@marples.name>
Sat, 14 Mar 2020 16:02:32 +0000 (16:02 +0000)
committerRoy Marples <roy@marples.name>
Sat, 14 Mar 2020 16:02:32 +0000 (16:02 +0000)
src/dhcpcd.c

index d8c102bbcde8c028b3bf7b3837bc3d7da9807ff6..bf5d74c38c8cbb20b53cf6ff7547f90fda848b85 100644 (file)
@@ -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");