From 0a20f4e5a64106d1793dd44d2fa0113417225d0f Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Mon, 24 Sep 2018 21:32:40 +0100
Subject: 43535: Fixes for bg / fg handling of superjobs.
Be more consistent about marking both superjob and subjob as
running when sending SIGCONT.
Send SIGCONT to superjob / subjob combination any time it is put
in foreground, even if thought running, since subjob may invisibly
have suspended.
When waiting for superjob, wait for subjob, too.
---
Src/signals.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
(limited to 'Src/signals.c')
diff --git a/Src/signals.c b/Src/signals.c
index 26d88abc2..f294049c2 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -782,7 +782,20 @@ killjb(Job jn, int sig)
if (kill(pn->pid, sig) == -1 && errno != ESRCH)
err = -1;
- return err;
+ /*
+ * The following marks both the superjob and subjob
+ * as running, as done elsewhere.
+ *
+ * It's not entirely clear to me what the right way
+ * to flag the status of a still-pausd final process,
+ * as handled above, but we should be cnsistent about
+ * this inside makerunning() rather than doing anything
+ * special here.
+ */
+ if (err != -1)
+ makerunning(jn);
+
+ return err;
}
if (killpg(jobtab[jn->other].gleader, sig) == -1 && errno != ESRCH)
err = -1;
@@ -792,8 +805,11 @@ killjb(Job jn, int sig)
return err;
}
- else
- return killpg(jn->gleader, sig);
+ else {
+ err = killpg(jn->gleader, sig);
+ if (sig == SIGCONT && err != -1)
+ makerunning(jn);
+ }
}
for (pn = jn->procs; pn; pn = pn->next) {
/*
--
cgit v1.2.3