From b7c6421796248d747f8cf0cad42f06969a2bc907 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Fri, 28 Jul 2000 16:35:47 +0000 Subject: The `wait' builtin accepts only PIDs it can find in the job table. --- Src/jobs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Src') 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; -- cgit 1.4.1