diff options
author | Andreas Bühmann <buehmann@users.berlios.de> | 2010-06-24 04:32:37 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-24 04:32:37 +0200 |
commit | da75f4484469ca0122b80de69bf3b75a6be71efc (patch) | |
tree | 8b7f6f1b13b0692e827a59abd8e6fa4257a6f4d3 | |
parent | 1b8e2b0e7620c5f80d93f4b7a5a225afe76c65da (diff) | |
download | busybox-w32-da75f4484469ca0122b80de69bf3b75a6be71efc.tar.gz busybox-w32-da75f4484469ca0122b80de69bf3b75a6be71efc.tar.bz2 busybox-w32-da75f4484469ca0122b80de69bf3b75a6be71efc.zip |
ash: <> redir should not truncate
Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-redir/redir9.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-redir/redir9.tests | 4 |
3 files changed, 7 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index f581b5bdf..1f8f90a09 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -4938,7 +4938,7 @@ openredirect(union node *redir) | |||
4938 | break; | 4938 | break; |
4939 | case NFROMTO: | 4939 | case NFROMTO: |
4940 | fname = redir->nfile.expfname; | 4940 | fname = redir->nfile.expfname; |
4941 | f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666); | 4941 | f = open(fname, O_RDWR|O_CREAT, 0666); |
4942 | if (f < 0) | 4942 | if (f < 0) |
4943 | goto ecreate; | 4943 | goto ecreate; |
4944 | break; | 4944 | break; |
diff --git a/shell/ash_test/ash-redir/redir9.right b/shell/ash_test/ash-redir/redir9.right new file mode 100644 index 000000000..34c2512e4 --- /dev/null +++ b/shell/ash_test/ash-redir/redir9.right | |||
@@ -0,0 +1,2 @@ | |||
1 | Ok | ||
2 | Done:0 | ||
diff --git a/shell/ash_test/ash-redir/redir9.tests b/shell/ash_test/ash-redir/redir9.tests new file mode 100644 index 000000000..8befa611c --- /dev/null +++ b/shell/ash_test/ash-redir/redir9.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | echo Ok >file.tmp | ||
2 | cat 0<>file.tmp | ||
3 | echo Done:$? | ||
4 | rm file.tmp | ||