diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2020-02-27 20:42:16 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2020-02-27 20:42:16 +0000 |
commit | 14ea665a903b26a658ef1d2ca974a9b48e09eff1 (patch) | |
tree | 443a5225cfac4052123b81c4d7c5b7ee5a5220c7 /Src/exec.c | |
parent | fe516fccb4754833f850cb62f6607226370bbf53 (diff) | |
download | zsh-14ea665a903b26a658ef1d2ca974a9b48e09eff1.tar.gz zsh-14ea665a903b26a658ef1d2ca974a9b48e09eff1.tar.xz zsh-14ea665a903b26a658ef1d2ca974a9b48e09eff1.zip |
users/24710: Fix job control problem with sudo.
If we use kill to test for continued existence of a process group, we should check on failure that the error is ESRCH, as EPERM indicates the group still has memebers but running privileged so should be left alone.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c index 50027654a..cf99051f0 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1036,7 +1036,8 @@ entersubsh(int flags, struct entersubsh_ret *retp) } else if (thisjob != -1 && (flags & ESUB_PGRP)) { if (jobtab[list_pipe_job].gleader && (list_pipe || list_pipe_child)) { if (setpgrp(0L, jobtab[list_pipe_job].gleader) == -1 || - killpg(jobtab[list_pipe_job].gleader, 0) == -1) { + (killpg(jobtab[list_pipe_job].gleader, 0) == -1 && + errno == ESRCH)) { jobtab[list_pipe_job].gleader = jobtab[thisjob].gleader = (list_pipe_child ? mypgrp : getpid()); setpgrp(0L, jobtab[list_pipe_job].gleader); |