aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-30 14:16:50 +0200
committerDaniel Hahler <git@thequod.de>2019-07-30 18:41:38 +0200
commit6e01ed6a4c859ff915b42422622f1ba3cc80efd5 (patch)
treef1716db148fdb8201723e5442fe2fc309e78f568 /src
parentda87b678125962076ce5627b1a32181284f2fe5d (diff)
downloadrneovim-6e01ed6a4c859ff915b42422622f1ba3cc80efd5.tar.gz
rneovim-6e01ed6a4c859ff915b42422622f1ba3cc80efd5.tar.bz2
rneovim-6e01ed6a4c859ff915b42422622f1ba3cc80efd5.zip
vim-patch:8.1.0572: stopping a job does not work properly on OpenBSD
Problem: Stopping a job does not work properly on OpenBSD. Solution: Do not use getpgid() to check the process group of the job processs ID, always pass the negative process ID to kill(). (George Koehler, closes vim/vim#3656) https://github.com/vim/vim/commit/76ab4fd61901090e6af3451ca6c5ca0fc370571f Ref: https://github.com/neovim/neovim/issues/9704 Ref: https://github.com/neovim/neovim/issues/10182#issuecomment-514450069 Closes https://github.com/neovim/neovim/pull/10660
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/process.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c
index a1020be215..c7b473a012 100644
--- a/src/nvim/os/process.c
+++ b/src/nvim/os/process.c
@@ -89,21 +89,12 @@ bool os_proc_tree_kill(int pid, int sig)
bool os_proc_tree_kill(int pid, int sig)
{
assert(sig == SIGTERM || sig == SIGKILL);
- int pgid = getpgid(pid);
- if (pgid > 0) { // Ignore error. Never kill self (pid=0).
- if (pgid == pid) {
- ILOG("sending %s to process group: -%d",
- sig == SIGTERM ? "SIGTERM" : "SIGKILL", pgid);
- int rv = uv_kill(-pgid, sig);
- return rv == 0;
- } else {
- // Should never happen, because process_spawn() did setsid() in the child.
- ELOG("pgid %d != pid %d", pgid, pid);
- }
- } else {
- ELOG("getpgid(%d) returned %d", pid, pgid);
+ if (pid == 0) {
+ // Never kill self (pid=0).
+ return false;
}
- return false;
+ ILOG("sending %s to PID %d", sig == SIGTERM ? "SIGTERM" : "SIGKILL", -pid);
+ return uv_kill(-pid, sig) == 0;
}
#endif