summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authoradam <adam@FreeBSD.org>1996-09-12 12:41:46 +0000
committeradam <adam@FreeBSD.org>1996-09-12 12:41:46 +0000
commitee00aff02ce974f4fece1defcd00446b1085ad33 (patch)
tree42aea7180a8d622a3ddf8973c4c8d578b548bfc4 /bin/sh
parent0d4dba7ce0ebcc64d616920b4126f1793b57d340 (diff)
downloadFreeBSD-src-ee00aff02ce974f4fece1defcd00446b1085ad33.zip
FreeBSD-src-ee00aff02ce974f4fece1defcd00446b1085ad33.tar.gz
Mend 'exit' without breaking 'exit 1'
*blush* %-\ Pointed out by: bruce
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 53daced..13ce050 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.6 1996/09/08 03:12:22 adam Exp $
+ * $Id: main.c,v 1.7 1996/09/12 02:23:33 bde Exp $
*/
#ifndef lint
@@ -339,10 +339,11 @@ exitcmd(argc, argv)
int argc;
char **argv;
{
+ extern int oexitstatus;
+
if (stoppedjobs())
return 0;
- if (argc > 1)
- exitstatus = number(argv[1]);
+ exitstatus = (argc > 1) ? number(argv[1]) : oexitstatus;
exitshell(exitstatus);
/*NOTREACHED*/
return 0;
OpenPOWER on IntegriCloud