From cc3bb3850c3aae72fe9bfa92b0cdc95caf1e909a Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 26 Apr 2016 20:07:29 +0000 Subject: [PATCH] Add a hack to ensure RUNDIR exists. --- compat/pidfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.47.3