summaryrefslogtreecommitdiffstats
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-08 14:39:05 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-08 14:39:05 +0100
commit76ab4fd61901090e6af3451ca6c5ca0fc370571f (patch)
tree793cb4cb12282655e89396531f11f6e09e119c72 /src/os_unix.c
parent446e7a3cd36b2de7d559f167eb5795d1e1cd3ddb (diff)
patch 8.1.0572: stopping a job does not work properly on OpenBSDv8.1.0572
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 #3656)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 4d902d9395..ecb348c4dc 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5820,7 +5820,6 @@ mch_detect_ended_job(job_T *job_list)
mch_signal_job(job_T *job, char_u *how)
{
int sig = -1;
- pid_t job_pid;
if (*how == NUL || STRCMP(how, "term") == 0)
sig = SIGTERM;
@@ -5841,16 +5840,13 @@ mch_signal_job(job_T *job, char_u *how)
else
return FAIL;
- /* TODO: have an option to only kill the process, not the group? */
- job_pid = job->jv_pid;
-#ifdef HAVE_GETPGID
- if (job_pid == getpgid(job_pid))
- job_pid = -job_pid;
-#endif
-
- /* Never kill ourselves! */
- if (job_pid != 0)
- kill(job_pid, sig);
+ // Never kill ourselves!
+ if (job->jv_pid != 0)
+ {
+ // TODO: have an option to only kill the process, not the group?
+ kill(-job->jv_pid, sig);
+ kill(job->jv_pid, sig);
+ }
return OK;
}