Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Don't wait with UNTRACED for jobs that have not been ...



details:   https://anonhg.NetBSD.org/src/rev/5c6b2b043c7f
branches:  trunk
changeset: 514788:5c6b2b043c7f
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 10 15:47:03 2001 +0000

description:
Don't wait with UNTRACED for jobs that have not been started with job control
(i.e. processes started from shell scripts). Fixes problem where kill -STOP'ing
a subprocess of a shell script would cause the shell to proceed to the next
command.

diffstat:

 bin/sh/jobs.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r 4c6fdeb44b7d -r 5c6b2b043c7f bin/sh/jobs.c
--- a/bin/sh/jobs.c     Mon Sep 10 15:36:19 2001 +0000
+++ b/bin/sh/jobs.c     Mon Sep 10 15:47:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jobs.c,v 1.37 2001/06/13 08:48:06 lukem Exp $  */
+/*     $NetBSD: jobs.c,v 1.38 2001/09/10 15:47:03 christos Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c     8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.37 2001/06/13 08:48:06 lukem Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.38 2001/09/10 15:47:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,7 @@
 STATIC struct job *getjob __P((char *));
 STATIC int dowait __P((int, struct job *));
 STATIC int onsigchild __P((void));
-STATIC int waitproc __P((int, int *));
+STATIC int waitproc __P((int, struct job *, int *));
 STATIC void cmdtxt __P((union node *));
 STATIC void cmdputs __P((const char *));
 
@@ -773,7 +773,7 @@
 
        TRACE(("dowait(%d) called\n", block));
        do {
-               pid = waitproc(block, &status);
+               pid = waitproc(block, job, &status);
                TRACE(("wait returns %d, status=%d\n", pid, status));
        } while (pid == -1 && errno == EINTR);
        if (pid <= 0)
@@ -889,17 +889,17 @@
 
 
 STATIC int
-waitproc(block, status)
+waitproc(block, jp, status)
        int block;
+       struct job *jp;
        int *status;
 {
 #ifdef BSD
-       int flags;
+       int flags = 0;
 
 #if JOBS
-       flags = WUNTRACED;
-#else
-       flags = 0;
+       if (jp->jobctl)
+               flags |= WUNTRACED;
 #endif
        if (block == 0)
                flags |= WNOHANG;



Home | Main Index | Thread Index | Old Index