From 6e01ed6a4c859ff915b42422622f1ba3cc80efd5 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 30 Jul 2019 14:16:50 +0200 Subject: 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 --- src/nvim/os/process.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src') 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 -- cgit