delete pid file check pid
parent
3042d28d2a
commit
96bb553688
2
HISTORY
2
HISTORY
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Version 1.24 2016-01-28
|
Version 1.24 2016-02-11
|
||||||
* php extension compiled on PHP 7
|
* php extension compiled on PHP 7
|
||||||
* add skiplist which support stable sort
|
* add skiplist which support stable sort
|
||||||
* make.sh: use sed to replace perl
|
* make.sh: use sed to replace perl
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,17 @@ int write_to_pid_file(const char *pidFilename)
|
||||||
|
|
||||||
int delete_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) {
|
if (unlink(pidFilename) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue