summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/contrib/ast/src/cmd/ksh93/sh/main.c7
-rwxr-xr-xusr/src/contrib/ast/src/cmd/ksh93/tests/io.sh14
2 files changed, 14 insertions, 7 deletions
diff --git a/usr/src/contrib/ast/src/cmd/ksh93/sh/main.c b/usr/src/contrib/ast/src/cmd/ksh93/sh/main.c
index e5fdc550b7..e334072821 100644
--- a/usr/src/contrib/ast/src/cmd/ksh93/sh/main.c
+++ b/usr/src/contrib/ast/src/cmd/ksh93/sh/main.c
@@ -580,13 +580,6 @@ static void exfile(register Shell_t *shp, register Sfio_t *iop,register int fno)
if(t)
{
execflags = sh_state(SH_ERREXIT)|sh_state(SH_INTERACTIVE);
- /* The last command may not have to fork */
- if(!sh_isstate(SH_PROFILE) && sh_isoption(SH_CFLAG) &&
- (fno<0 || !(shp->fdstatus[fno]&(IOTTY|IONOSEEK)))
- && !sfreserve(iop,0,0))
- {
- execflags |= sh_state(SH_NOFORK);
- }
shp->st.execbrk = 0;
sh_exec(t,execflags);
if(shp->forked)
diff --git a/usr/src/contrib/ast/src/cmd/ksh93/tests/io.sh b/usr/src/contrib/ast/src/cmd/ksh93/tests/io.sh
index c4a5fdf6ac..819ce7ba86 100755
--- a/usr/src/contrib/ast/src/cmd/ksh93/tests/io.sh
+++ b/usr/src/contrib/ast/src/cmd/ksh93/tests/io.sh
@@ -496,4 +496,18 @@ done {n}< /dev/null
n=$( exec {n}< /dev/null; print -r -- $n)
[[ -r /dev/fd/$n ]] && err_exit "file descriptor n=$n left open after subshell"
+# ==========
+# https://github.com/att/ast/issues/9
+tf=`mktemp`
+echo foo bar > $tf
+$SHELL -c 'echo xxx 1<>; '$tf
+actual=$(cat $tf)
+expect="xxx"
+[[ "$actual" = "$expect" ]] || err_exit "<>; does not truncate files - $expect - $actual"
+rm -f $tf
+
+cp /dev/null $tf
+$SHELL -c '{ echo "Foo"; echo "bar"; uname; } >; '$tf
+[[ -s "$tf" ]] || err_exit ">; does not work with -c"
+rm -f $tf
exit $((Errors<125?Errors:125))