diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-03-09 12:58:24 +0800 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2010-03-22 00:29:18 +0100 |
commit | 85e0590422db9f61c48413bb162297f4e573f868 (patch) | |
tree | c476c6a36f47b3da8c7430b2bde573efa85a4bc6 | |
parent | 20e96dc369ce79c3061f44440f52329d99f26536 (diff) | |
download | klibc-85e0590422db9f61c48413bb162297f4e573f868.tar.gz |
[klibc] [REDIR] Do not truncate file for FROMTO redirection
On Tue, Jun 23, 2009 at 10:06:30AM +0000, Nikola Vladov wrote:
> May be this is a bug:
>
> echo XX > uu
> cat <> uu
>
> dash truncates file uu. The open flag O_TRUNC must be removed.
> I'm not 100% shure what POSIX say about: program <> file
Indeed, this is a bug we inherited from NetBSD. This patch removes
the O_TRUNC flag for FROMTO.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r-- | usr/dash/redir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/dash/redir.c b/usr/dash/redir.c index b01237db9fc65..54af96b05c4b1 100644 --- a/usr/dash/redir.c +++ b/usr/dash/redir.c @@ -192,7 +192,7 @@ openredirect(union node *redir) break; case NFROMTO: fname = redir->nfile.expfname; - if ((f = open64(fname, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + if ((f = open64(fname, O_RDWR|O_CREAT, 0666)) < 0) goto ecreate; break; case NTO: |