Module Name: src Committed By: martin Date: Fri Dec 7 13:12:02 UTC 2018
Modified Files: src/bin/sh [netbsd-8]: redir.c Log Message: Pull up following revision(s) (requested by kre in ticket #1125): bin/sh/redir.c: revision 1.61 Fix the <> redirection operator, which has been broken since it was first implemented in response to PR bin/4966 (PR Feb 1998, fix Feb 1999). The file named should not be truncated. No other shell truncates the file (<> was added to FreeBSD sh in Oct 2000, and did not include O_TRUNC) and POSIX certainly does not suggest that should happen (just that the file is to be created if it does not exist.) Bug pointed out in off-list e-mail by Martijn Dekker To generate a diff of this commit: cvs rdiff -u -r1.57.2.1 -r1.57.2.2 src/bin/sh/redir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/redir.c diff -u src/bin/sh/redir.c:1.57.2.1 src/bin/sh/redir.c:1.57.2.2 --- src/bin/sh/redir.c:1.57.2.1 Sun Jul 23 14:58:14 2017 +++ src/bin/sh/redir.c Fri Dec 7 13:12:02 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: redir.c,v 1.57.2.1 2017/07/23 14:58:14 snj Exp $ */ +/* $NetBSD: redir.c,v 1.57.2.2 2018/12/07 13:12:02 martin Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: redir.c,v 1.57.2.1 2017/07/23 14:58:14 snj Exp $"); +__RCSID("$NetBSD: redir.c,v 1.57.2.2 2018/12/07 13:12:02 martin Exp $"); #endif #endif /* not lint */ @@ -283,7 +283,7 @@ openredirect(union node *redir, char mem break; case NFROMTO: fname = redir->nfile.expfname; - if ((f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) goto ecreate; break; case NTO: