diff options
author | jilles <jilles@FreeBSD.org> | 2013-07-12 15:29:41 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-07-12 15:29:41 +0000 |
commit | e87e084ab729c231e686628c43d037232a4aa81e (patch) | |
tree | cf889572ab9e60f57634f30de86f53f611365ca9 /bin/sh/main.c | |
parent | de0b6f6b4c63f1aa9296e17bf5e33093a2dca481 (diff) | |
download | FreeBSD-src-e87e084ab729c231e686628c43d037232a4aa81e.zip FreeBSD-src-e87e084ab729c231e686628c43d037232a4aa81e.tar.gz |
sh: Do not read from stdin if an error occurs during -i -c cmd.
Although using -i with -c does not seem very useful, it seems inappropriate
to read commands from the terminal in this case.
Side effect: if the -s -c extension is used and the -s option is turned off
using 'set +s' during the interactive part, the shell now exits after an
error or interrupt. Note that POSIX only specifies -s as option to sh, not
to set.
See also Austin Group issue #718.
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r-- | bin/sh/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c index ffe8a61..0c496d0 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -170,8 +170,8 @@ state3: if (minusc) { evalstring(minusc, sflag ? 0 : EV_EXIT); } +state4: if (sflag || minusc == NULL) { -state4: /* XXX ??? - why isn't this before the "if" statement */ cmdloop(1); } exitshell(exitstatus); |