diff --git a/HISTORY b/HISTORY index 35a2bd6..381763b 100644 --- a/HISTORY +++ b/HISTORY @@ -1,5 +1,5 @@ -Version 1.24 2016-01-28 +Version 1.24 2016-02-11 * php extension compiled on PHP 7 * add skiplist which support stable sort * make.sh: use sed to replace perl diff --git a/src/process_ctrl.c b/src/process_ctrl.c index a62ca77..3b6f917 100644 --- a/src/process_ctrl.c +++ b/src/process_ctrl.c @@ -42,6 +42,17 @@ int write_to_pid_file(const char *pidFilename) int delete_pid_file(const char *pidFilename) { + int result; + pid_t pid; + + if ((result=get_pid_from_file(pidFilename, &pid)) != 0) { + return result; + } + + if (pid != getpid()) { + return ESRCH; + } + if (unlink(pidFilename) == 0) { return 0; }