From: Roy Marples Date: Tue, 26 Apr 2016 20:07:29 +0000 (+0000) Subject: Add a hack to ensure RUNDIR exists. X-Git-Tag: v6.11.0~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc3bb3850c3aae72fe9bfa92b0cdc95caf1e909a;p=thirdparty%2Fdhcpcd.git Add a hack to ensure RUNDIR exists. --- diff --git a/compat/pidfile.c b/compat/pidfile.c index 5adb3972..00b87fdc 100644 --- a/compat/pidfile.c +++ b/compat/pidfile.c @@ -50,9 +50,6 @@ __RCSID("$NetBSD: pidfile.c,v 1.14 2016/04/12 20:40:43 roy Exp $"); #include "../config.h" #include "../defs.h" -#undef _PATH_VARRUN -#define _PATH_VARRUN RUNDIR - static pid_t pidfile_pid; static char pidfile_path[PATH_MAX]; static int pidfile_fd = -1; @@ -204,6 +201,10 @@ pidfile_lock(const char *path) if (pidfile_fd == -1) { int fd, opts; + /* Ensure we have the needed directories */ + if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST) + return -1; + opts = O_WRONLY | O_CREAT | O_NONBLOCK; #ifdef O_CLOEXEC opts |= O_CLOEXEC;