summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-03-15 20:29:31 +0000
committerjilles <jilles@FreeBSD.org>2013-03-15 20:29:31 +0000
commitd967c25f5c41bb5547a03c9b1ce042cb778c54cc (patch)
tree84d8e3b2a4fff8196acae606e87e71bcee71109c
parente3bfa0687cf43740ac4bf886a8089374386b1d0d (diff)
downloadFreeBSD-src-d967c25f5c41bb5547a03c9b1ce042cb778c54cc.zip
FreeBSD-src-d967c25f5c41bb5547a03c9b1ce042cb778c54cc.tar.gz
sh: Recognize "--" and explicitly reject options in wait builtin.
If syntactically invalid job identifiers are to be taken as jobs that exited with status 127, this should not apply to options, so that we can add options later if need be.
-rw-r--r--bin/sh/jobs.c7
-rw-r--r--tools/regression/bin/sh/builtins/wait6.03
-rw-r--r--tools/regression/bin/sh/builtins/wait7.04
3 files changed, 11 insertions, 3 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 5a2790b..a092884 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -458,14 +458,15 @@ freejob(struct job *jp)
int
-waitcmd(int argc, char **argv)
+waitcmd(int argc __unused, char **argv __unused)
{
struct job *job;
int status, retval;
struct job *jp;
- if (argc > 1) {
- job = getjob(argv[1]);
+ nextopt("");
+ if (*argptr != NULL) {
+ job = getjob(*argptr);
} else {
job = NULL;
}
diff --git a/tools/regression/bin/sh/builtins/wait6.0 b/tools/regression/bin/sh/builtins/wait6.0
new file mode 100644
index 0000000..20e3c68
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/wait6.0
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+wait --
diff --git a/tools/regression/bin/sh/builtins/wait7.0 b/tools/regression/bin/sh/builtins/wait7.0
new file mode 100644
index 0000000..0fb092f
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/wait7.0
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+: &
+wait -- $!
OpenPOWER on IntegriCloud