ash: <> redir should not truncate
authorAndreas Bühmann <buehmann@users.berlios.de>
Thu, 24 Jun 2010 02:32:37 +0000 (04:32 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 24 Jun 2010 02:32:37 +0000 (04:32 +0200)
Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/ash_test/ash-redir/redir9.right [new file with mode: 0644]
shell/ash_test/ash-redir/redir9.tests [new file with mode: 0644]

index f581b5bdf63bc415d44c6f83be8afa218fa0e1e6..1f8f90a091f9f432d171240994f24ea4176d2a3c 100644 (file)
@@ -4938,7 +4938,7 @@ openredirect(union node *redir)
                break;
        case NFROMTO:
                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)
                        goto ecreate;
                break;
diff --git a/shell/ash_test/ash-redir/redir9.right b/shell/ash_test/ash-redir/redir9.right
new file mode 100644 (file)
index 0000000..34c2512
--- /dev/null
@@ -0,0 +1,2 @@
+Ok
+Done:0
diff --git a/shell/ash_test/ash-redir/redir9.tests b/shell/ash_test/ash-redir/redir9.tests
new file mode 100644 (file)
index 0000000..8befa61
--- /dev/null
@@ -0,0 +1,4 @@
+echo Ok >file.tmp
+cat 0<>file.tmp
+echo Done:$?
+rm file.tmp