mirror of
https://github.com/troglobit/libite.git
synced 2026-10-03 06:03:11 +07:00
pidfile_signal(): Return result of kill() and only remove on SIGKILL
If kill() is successful, and the signal was SIGKILL, we remove() the PID file and return the rc of remove(), otherwise we always return the rc of kill(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -9,6 +9,10 @@ All notable changes to the project are documented in this file.
|
||||
### Changes
|
||||
- Add support for `strmatch()` and `strnmatch()`
|
||||
|
||||
### Fixes
|
||||
- Fix `pidfile_signal()`: always return result of `kill()`, or the
|
||||
result of `remove()` if we successfully sent `SIGKILL`
|
||||
|
||||
|
||||
[v2.0.2][] - 2018-05-10
|
||||
-----------------------
|
||||
|
||||
+3
-3
@@ -111,10 +111,10 @@ int pidfile_signal(const char *pidfile, int signal)
|
||||
return 1;
|
||||
|
||||
ret = kill(pid, signal);
|
||||
if ((ret == -1) || (signal == SIGTERM) || (signal == SIGKILL))
|
||||
(void)remove(pidfile);
|
||||
if (!ret && signal == SIGKILL)
|
||||
ret = remove(pidfile);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user