about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c9
-rw-r--r--Src/jobs.c3
2 files changed, 2 insertions, 10 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 27f964430..720620e71 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1760,13 +1760,6 @@ execcmd(Cmd cmd, int input, int output, int how, int last1)
 #ifdef PATH_DEV_FD
 	    closem(2);
 #endif
-
-	    /* If there is already a group leader but that has died, we make
-	     * this one the leader. */
-	    if (pline_level == 1 && jobtab[thisjob].procs &&
-		kill(jobtab[thisjob].gleader, 0) == -1)
-		jobtab[thisjob].gleader = pid;
-
 	    if (how & Z_ASYNC) {
 		lastpid = (zlong) pid;
 	    } else if (!jobtab[thisjob].stty_in_env &&
@@ -2243,7 +2236,7 @@ entersubsh(int how, int cl, int fake)
 	}
     } else if (thisjob != -1 && cl) {
 	if (jobtab[list_pipe_job].gleader && (list_pipe || list_pipe_child)) {
-	    if (kill(jobtab[list_pipe_job].gleader, 0) == -1 ||
+	    if (killpg(jobtab[list_pipe_job].gleader, 0) == -1 ||
 		setpgrp(0L, jobtab[list_pipe_job].gleader) == -1) {
 		jobtab[list_pipe_job].gleader =
 		    jobtab[thisjob].gleader = (list_pipe_child ? mypgrp : getpid());
diff --git a/Src/jobs.c b/Src/jobs.c
index fdf69a960..7b060cd87 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1292,8 +1292,7 @@ bin_fg(char *name, char **argv, char *ops, int func)
 		    thisjob = job;
 		    if ((jobtab[job].stat & STAT_SUPERJOB) &&
 			((!jobtab[job].procs->next ||
-			  WIFEXITED(jobtab[job].procs->status) ||
-			  WIFSIGNALED(jobtab[job].procs->status))) &&
+			  killpg(jobtab[job].gleader, 0) == -1)) &&
 			jobtab[jobtab[job].other].gleader)
 			attachtty(jobtab[jobtab[job].other].gleader);
 		    else