diff --git a/ChangeLog.md b/ChangeLog.md index 92f094c..224f750 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 ----------------------- diff --git a/src/pidfilefn.c b/src/pidfilefn.c index bb32b3b..e88f9db 100644 --- a/src/pidfilefn.c +++ b/src/pidfilefn.c @@ -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; } /**