diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-26 08:29:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-10-26 08:29:53 +0000 |
commit | d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01 (patch) | |
tree | 8c283d1c81d718e64d87d9a2d1132c89f3915939 /daemon/main.c | |
parent | Releasing debian version 1.18.0-1. (diff) | |
download | netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.tar.xz netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.zip |
Merging upstream version 1.18.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/main.c')
-rw-r--r-- | daemon/main.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/daemon/main.c b/daemon/main.c index 4189ac7bd..0e56654db 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -146,46 +146,28 @@ void web_server_config_options(void) { } -int killpid(pid_t pid, int signal) -{ - int ret = -1; +// killpid kills pid with SIGTERM. +int killpid(pid_t pid) { + int ret; debug(D_EXIT, "Request to kill pid %d", pid); errno = 0; - if(kill(pid, 0) == -1) { + ret = kill(pid, SIGTERM); + if (ret == -1) { switch(errno) { case ESRCH: - error("Request to kill pid %d, but it is not running.", pid); - break; + // We wanted the process to exit so just let the caller handle. + return ret; case EPERM: - error("Request to kill pid %d, but I do not have enough permissions.", pid); + error("Cannot kill pid %d, but I do not have enough permissions.", pid); break; default: - error("Request to kill pid %d, but I received an error.", pid); + error("Cannot kill pid %d, but I received an error.", pid); break; } } - else { - errno = 0; - ret = kill(pid, signal); - if(ret == -1) { - switch(errno) { - case ESRCH: - error("Cannot kill pid %d, but it is not running.", pid); - break; - - case EPERM: - error("Cannot kill pid %d, but I do not have enough permissions.", pid); - break; - - default: - error("Cannot kill pid %d, but I received an error.", pid); - break; - } - } - } return ret; } |