Skip to content

Commit 76ab4fd

Browse files
committed
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 #3656)
1 parent 446e7a3 commit 76ab4fd

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/os_unix.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5820,7 +5820,6 @@ mch_detect_ended_job(job_T *job_list)
58205820
mch_signal_job(job_T *job, char_u *how)
58215821
{
58225822
int sig = -1;
5823-
pid_t job_pid;
58245823

58255824
if (*how == NUL || STRCMP(how, "term") == 0)
58265825
sig = SIGTERM;
@@ -5841,16 +5840,13 @@ mch_signal_job(job_T *job, char_u *how)
58415840
else
58425841
return FAIL;
58435842

5844-
/* TODO: have an option to only kill the process, not the group? */
5845-
job_pid = job->jv_pid;
5846-
#ifdef HAVE_GETPGID
5847-
if (job_pid == getpgid(job_pid))
5848-
job_pid = -job_pid;
5849-
#endif
5850-
5851-
/* Never kill ourselves! */
5852-
if (job_pid != 0)
5853-
kill(job_pid, sig);
5843+
// Never kill ourselves!
5844+
if (job->jv_pid != 0)
5845+
{
5846+
// TODO: have an option to only kill the process, not the group?
5847+
kill(-job->jv_pid, sig);
5848+
kill(job->jv_pid, sig);
5849+
}
58545850

58555851
return OK;
58565852
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ static char *(features[]) =
792792

793793
static int included_patches[] =
794794
{ /* Add new patch number below this line */
795+
/**/
796+
572,
795797
/**/
796798
571,
797799
/**/

0 commit comments

Comments
 (0)