From a466c9e62a02e30284f568f1ec62551a7faaed8d Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Wed, 30 Apr 2014 12:47:59 +0200 Subject: init.d/functions: check parent dir of pid file for accessibility --- rc.d/init.d/functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 8c4d2573..9f1c76f1 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -110,6 +110,9 @@ checkpid() { __pids_var_run() { local base=${1##*/} local pid_file=${2:-/var/run/$base.pid} + local pid_dir=$(/usr/bin/dirname $pid_file > /dev/null) + + [ -d "$pid_dir" -a ! -r "$pid_dir" ] && return 4 pid= if [ -f "$pid_file" ] ; then -- cgit v1.2.1