about summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/Src/signals.c b/Src/signals.c
index 71fac245d..94cf1099f 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -592,22 +592,44 @@ killjb(Job jn, int sig)
             if (sig == SIGCONT) {
                 for (pn = jobtab[jn->other].procs; pn; pn = pn->next)
                     if (killpg(pn->pid, sig) == -1)
-			kill(pn->pid, sig);
+			if (kill(pn->pid, sig) == -1 && errno != ESRCH)
+#ifdef BROKEN_KILL_ESRCH
+			    if(errno != EINVAL || sig != 0)
+#endif /* BROKEN_KILL_ESRCH */
+				err = -1;
  
                 for (pn = jn->procs; pn->next; pn = pn->next)
-                    err = kill(pn->pid, sig);
+                    if (kill(pn->pid, sig) == -1 && errno != ESRCH)
+#ifdef BROKEN_KILL_ESRCH
+			if(errno != EINVAL || sig != 0)
+#endif /* BROKEN_KILL_ESRCH */
+			    err = -1;
 
 		if (!jobtab[jn->other].procs && pn)
-		    err = kill(pn->pid, sig);
+		    if (kill(pn->pid, sig) == -1 && errno != ESRCH)
+#ifdef BROKEN_KILL_ESRCH
+			if(errno != EINVAL || sig != 0)
+#endif /* BROKEN_KILL_ESRCH */
+			    err = -1;
 
                 return err;
             }
- 
-            killpg(jobtab[jn->other].gleader, sig);
-            return killpg(jn->gleader, sig);
+            if (killpg(jobtab[jn->other].gleader, sig) == -1 && errno != ESRCH)
+#ifdef BROKEN_KILL_ESRCH
+		if(errno != EINVAL || sig != 0)
+#endif /* BROKEN_KILL_ESRCH */
+		    err = -1;
+		
+	    if (killpg(jn->gleader, sig) == -1 && errno != ESRCH)
+#ifdef BROKEN_KILL_ESRCH
+		if(errno != EINVAL || sig != 0)
+#endif /* BROKEN_KILL_ESRCH */
+		    err = -1;
+
+	    return err;
         }
         else
-            return (killpg(jn->gleader, sig));
+	    return killpg(jn->gleader, sig);
     }
     for (pn = jn->procs; pn; pn = pn->next)
         if ((err = kill(pn->pid, sig)) == -1 && errno != ESRCH)