delete pid file check pid

pull/10/head
yuqing 2016-02-11 13:55:44 +08:00
parent 3042d28d2a
commit 96bb553688
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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;
}