summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-04-26 20:09:34 +0000
committerRoy Marples <roy@marples.name>2016-04-26 20:09:34 +0000
commitd4b2fdf14a88ebf31da15c50156a6a7cd62dde5c (patch)
treedeb0f7b73cb18cbf2d52ce46970590a32a901eff /dhcpcd.c
parentcc3bb3850c3aae72fe9bfa92b0cdc95caf1e909a (diff)
downloaddhcpcd-d4b2fdf14a88ebf31da15c50156a6a7cd62dde5c.tar.xz
Revert prior and just move the RUNDIR check above pidfile_lock.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 8e6b0367..c19c6ef8 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1790,6 +1790,12 @@ printpidfile:
}
if (!(ctx.options & DHCPCD_TEST)) {
+ /* Ensure we have the needed directories */
+ if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST)
+ logger(&ctx, LOG_ERR, "mkdir `%s': %m", RUNDIR);
+ if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST)
+ logger(&ctx, LOG_ERR, "mkdir `%s': %m", DBDIR);
+
if ((pid = pidfile_lock(ctx.pidfile)) != 0) {
if (pid == -1)
logger(&ctx, LOG_ERR, "%s: pidfile_lock: %m",
@@ -1800,12 +1806,6 @@ printpidfile:
pid, ctx.pidfile);
goto exit_failure;
}
-
- /* Ensure we have the needed directories */
- if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST)
- logger(&ctx, LOG_ERR, "mkdir `%s': %m", RUNDIR);
- if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST)
- logger(&ctx, LOG_ERR, "mkdir `%s': %m", DBDIR);
}
if (ctx.options & DHCPCD_MASTER) {