Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/bin/sh Pull up following revision(s) (requested by kre in...
details: https://anonhg.NetBSD.org/src/rev/1c541905f4bd
branches: netbsd-8
changeset: 852161:1c541905f4bd
user: martin <martin%NetBSD.org@localhost>
date: Fri Dec 07 13:12:02 2018 +0000
description:
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
diffstat:
bin/sh/redir.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 5869d5cc3809 -r 1c541905f4bd bin/sh/redir.c
--- a/bin/sh/redir.c Fri Dec 07 13:09:14 2018 +0000
+++ b/bin/sh/redir.c Fri Dec 07 13:12:02 2018 +0000
@@ -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 @@
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:
Home |
Main Index |
Thread Index |
Old Index