bin/173924: [patch] import upstream nvi -Wshadow O_DIRECTORY fix

Garrett Cooper yanegomi at gmail.com
Mon Nov 26 04:20:01 UTC 2012


>Number:         173924
>Category:       bin
>Synopsis:       [patch] import upstream nvi -Wshadow O_DIRECTORY fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 26 04:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-STABLE / 10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012     gcooper at bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
Upstream nvi provided a fix ~5 years ago to not shadow O_DIRECTORY (a constant that can be used with open(2)):

The attached patch is the verbatim fix for the issue along with the relevant commit log and can be verified via the git repo at "git://repo.or.cz/nvi.git".
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

>From 07fd7151247068ce418d8a4847003369b5dbd1d2 Mon Sep 17 00:00:00 2001
From: Sven Verdoolaege <skimo at kotnet.org>
Date: Sun, 2 Jul 2006 12:59:20 +0200
Subject: [PATCH] rename O_DIRECTORY to O_TMP_DIRECTORY to avoid conflict with
 open option

---
 common/exf.c     | 4 ++--
 common/options.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/exf.c b/common/exf.c
index 358c433..195d2c0 100644
--- a/common/exf.c
+++ b/common/exf.c
@@ -195,10 +195,10 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags)
 	 */
 	oname = frp->name;
 	if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
-		if (opts_empty(sp, O_DIRECTORY, 0))
+		if (opts_empty(sp, O_TMP_DIRECTORY, 0))
 			goto err;
 		(void)snprintf(tname, sizeof(tname),
-		    "%s/vi.XXXXXX", O_STR(sp, O_DIRECTORY));
+		    "%s/vi.XXXXXX", O_STR(sp, O_TMP_DIRECTORY));
 		if ((fd = mkstemp(tname)) == -1) {
 			msgq(sp, M_SYSERR,
 			    "237|Unable to create temporary file");
diff --git a/common/options.c b/common/options.c
index c8313d9..ed45864 100644
--- a/common/options.c
+++ b/common/options.c
@@ -72,7 +72,7 @@ OPTLIST const optlist[] = {
 	{L("combined"),	NULL,		OPT_0BOOL,	OPT_NOSET|OPT_WC},
 /* O_COMMENT	  4.4BSD */
 	{L("comment"),	NULL,		OPT_0BOOL,	0},
-/* O_DIRECTORY	    4BSD */
+/* O_TMP_DIRECTORY	    4BSD */
 	{L("directory"),	NULL,		OPT_STR,	0},
 /* O_EDCOMPATIBLE   4BSD */
 	{L("edcompatible"),NULL,		OPT_0BOOL,	0},
@@ -252,7 +252,7 @@ static OABBREV const abbrev[] = {
 	{L("aw"),	O_AUTOWRITE},		/*     4BSD */
 	{L("bf"),	O_BEAUTIFY},		/*     4BSD */
 	{L("co"),	O_COLUMNS},		/*   4.4BSD */
-	{L("dir"),	O_DIRECTORY},		/*     4BSD */
+	{L("dir"),	O_TMP_DIRECTORY},	/*     4BSD */
 	{L("eb"),	O_ERRORBELLS},		/*     4BSD */
 	{L("ed"),	O_EDCOMPATIBLE},	/*     4BSD */
 	{L("ex"),	O_EXRC},		/* System V (undocumented) */
@@ -355,7 +355,7 @@ opts_init(SCR *sp, int *oargs)
 	 */
 	(void)SPRINTF(b2, SIZE(b2),
 	    L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s);
-	OI(O_DIRECTORY, b2);
+	OI(O_TMP_DIRECTORY, b2);
 	OI(O_ESCAPETIME, L("escapetime=1"));
 	OI(O_KEYTIME, L("keytime=6"));
 	OI(O_MATCHTIME, L("matchtime=7"));
-- 
1.8.0



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list