diff options
| author | Roy Marples <roy@marples.name> | 2020-03-14 16:02:32 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-03-14 16:02:32 +0000 |
| commit | 303500c5365369ce8b8baed73d401b17b85544d1 (patch) | |
| tree | 5c37a9fec4db67b8d3b9f51337a6a14cd1982908 | |
| parent | 0035fb391f55ba9b124d2554d3ab4018f8fdfad8 (diff) | |
| download | dhcpcd-303500c5365369ce8b8baed73d401b17b85544d1.tar.xz | |
privsep: Don't create DB directory in the real root as well.
| -rw-r--r-- | src/dhcpcd.c | 10 |
1 files changed, 7 insertions, 3 deletions
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"); |
