ash: <> redir should not truncate

Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Andreas Bühmann 2010-06-24 04:32:37 +02:00 committed by Denys Vlasenko
parent 1b8e2b0e76
commit da75f44844
3 changed files with 7 additions and 1 deletions

View File

@ -4938,7 +4938,7 @@ openredirect(union node *redir)
break; break;
case NFROMTO: case NFROMTO:
fname = redir->nfile.expfname; fname = redir->nfile.expfname;
f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666); f = open(fname, O_RDWR|O_CREAT, 0666);
if (f < 0) if (f < 0)
goto ecreate; goto ecreate;
break; break;

View File

@ -0,0 +1,2 @@
Ok
Done:0

View File

@ -0,0 +1,4 @@
echo Ok >file.tmp
cat 0<>file.tmp
echo Done:$?
rm file.tmp