diff options
author | jilles <jilles@FreeBSD.org> | 2011-04-25 20:54:12 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-04-25 20:54:12 +0000 |
commit | 7b50330e011dfd112eaa530e79b7b29d8152e6d6 (patch) | |
tree | 0826bffcc674a347b694041997a07842486d94c1 /tools | |
parent | e9f95ffefb85c41251ae3400a0cd59d46d241f60 (diff) | |
download | FreeBSD-src-7b50330e011dfd112eaa530e79b7b29d8152e6d6.zip FreeBSD-src-7b50330e011dfd112eaa530e79b7b29d8152e6d6.tar.gz |
sh: Set $? to 0 for background commands.
For backgrounded pipelines and subshells, the previous value of $? was being
preserved, which is incorrect.
For backgrounded simple commands containing a command substitution, the
status of the last command substitution was returned instead of 0.
If fork() fails, this is an error.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/bin/sh/execution/bg1.0 | 3 | ||||
-rw-r--r-- | tools/regression/bin/sh/execution/bg2.0 | 5 | ||||
-rw-r--r-- | tools/regression/bin/sh/execution/bg3.0 | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/execution/bg1.0 b/tools/regression/bin/sh/execution/bg1.0 new file mode 100644 index 0000000..edb92ae --- /dev/null +++ b/tools/regression/bin/sh/execution/bg1.0 @@ -0,0 +1,3 @@ +# $FreeBSD$ + +: `false` & diff --git a/tools/regression/bin/sh/execution/bg2.0 b/tools/regression/bin/sh/execution/bg2.0 new file mode 100644 index 0000000..2e2fbc5 --- /dev/null +++ b/tools/regression/bin/sh/execution/bg2.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +f() { return 42; } +f +: | : & diff --git a/tools/regression/bin/sh/execution/bg3.0 b/tools/regression/bin/sh/execution/bg3.0 new file mode 100644 index 0000000..359fc6f --- /dev/null +++ b/tools/regression/bin/sh/execution/bg3.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +f() { return 42; } +f +(:) & |