about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-07-28 16:35:47 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-07-28 16:35:47 +0000
commitb7c6421796248d747f8cf0cad42f06969a2bc907 (patch)
tree1d985c489b9b846f191cd5639ffbe0b31c31dc81
parent7697f6134f8b519c1eb626ad082b6e983ea99430 (diff)
downloadzsh-b7c6421796248d747f8cf0cad42f06969a2bc907.tar.gz
zsh-b7c6421796248d747f8cf0cad42f06969a2bc907.tar.xz
zsh-b7c6421796248d747f8cf0cad42f06969a2bc907.zip
The `wait' builtin accepts only PIDs it can find in the job table.
-rw-r--r--ChangeLog6
-rw-r--r--Src/jobs.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3df1a7f7e..1a77d7843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-07-28  Bart Schaefer  <schaefer@zsh.org>
+
+	* 12393: Src/jobs.c: The `wait' builtin searches the job table for
+	any process ID it's asked to wait for, and rejects those it
+	doesn't find.
+
 2000-07-28  Peter Stephenson  <pws@csr.com>
 
 	* 12421: Src/Makemod.in.in: extra tab
diff --git a/Src/jobs.c b/Src/jobs.c
index 02009ec9b..ea96200eb 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1289,7 +1289,13 @@ bin_fg(char *name, char **argv, char *ops, int func)
 
 	if (func == BIN_WAIT && isanum(*argv)) {
 	    /* wait can take a pid; the others can't. */
-	    waitforpid((long)atoi(*argv));
+	    pid_t pid = (long)atoi(*argv);
+	    Job j;
+	    Process p;
+	    if (findproc(pid, &j, &p))
+		waitforpid(pid);
+	    else
+		zwarnnam(name, "pid %d is not a child of this shell", 0, pid);
 	    retval = lastval2;
 	    thisjob = ocj;
 	    continue;