diff options
author | jilles <jilles@FreeBSD.org> | 2011-01-08 23:08:13 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-01-08 23:08:13 +0000 |
commit | 3a61afec3c31632aa62686e28a104916e353199d (patch) | |
tree | 84939e2426e96e9045071ec8b0ff19c67e89c0c7 /bin/sh/main.c | |
parent | 2801f33bdaf165233d1ce6d66f6fb981044439e0 (diff) | |
download | FreeBSD-src-3a61afec3c31632aa62686e28a104916e353199d.zip FreeBSD-src-3a61afec3c31632aa62686e28a104916e353199d.tar.gz |
sh: Make exit without parameters from EXIT trap POSIX-compliant.
It should use the original exit status, just like falling off the
end of the trap handler.
Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r-- | bin/sh/main.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c index 9298f69..88483b0 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -341,10 +341,7 @@ exitcmd(int argc, char **argv) if (stoppedjobs()) return 0; if (argc > 1) - exitstatus = number(argv[1]); + exitshell(number(argv[1])); else - exitstatus = oexitstatus; - exitshell(exitstatus); - /*NOTREACHED*/ - return 0; + exitshell_savedstatus(); } |