From nobody@FreeBSD.org  Mon Nov 26 04:14:49 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2D62EEF
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 04:14:49 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id EE35A8FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 04:14:48 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ4EmgA066426
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 04:14:48 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qAQ4EmLE066425;
	Mon, 26 Nov 2012 04:14:48 GMT
	(envelope-from nobody)
Message-Id: <201211260414.qAQ4EmLE066425@red.freebsd.org>
Date: Mon, 26 Nov 2012 04:14:48 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] import upstream nvi -Wshadow O_DIRECTORY fix
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173924
>Category:       bin
>Synopsis:       [patch] nvi(1): import upstream nvi -Wshadow O_DIRECTORY fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jh
>State:          patched
>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:  Wed May 15 19:00:00 UTC 2013
>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@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@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:
Responsible-Changed-From-To: freebsd-bugs->jh 
Responsible-Changed-By: jh 
Responsible-Changed-When: Wed May 15 16:46:26 UTC 2013 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173924 
State-Changed-From-To: open->patched 
State-Changed-By: jh 
State-Changed-When: Wed May 15 18:48:50 UTC 2013 
State-Changed-Why:  
Committed to head (r250667). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173924 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/173924: commit references a PR
Date: Wed, 15 May 2013 18:41:58 +0000 (UTC)

 Author: jh
 Date: Wed May 15 18:41:49 2013
 New Revision: 250667
 URL: http://svnweb.freebsd.org/changeset/base/250667
 
 Log:
   Rename O_DIRECTORY to O_TMP_DIRECTORY to avoid shadowing the fcntl.h
   O_DIRECTORY flag.
   
   PR:		bin/173924
   Obtained from:	git://repo.or.cz/nvi.git
 
 Modified:
   head/contrib/nvi/common/exf.c
   head/contrib/nvi/common/options.c
   head/contrib/nvi/include/options_def.h
 
 Modified: head/contrib/nvi/common/exf.c
 ==============================================================================
 --- head/contrib/nvi/common/exf.c	Wed May 15 18:38:28 2013	(r250666)
 +++ head/contrib/nvi/common/exf.c	Wed May 15 18:41:49 2013	(r250667)
 @@ -187,10 +187,10 @@ file_init(sp, frp, rcv_name, 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.XXXXXXXXXX", O_STR(sp, O_DIRECTORY));
 +		    "%s/vi.XXXXXXXXXX", O_STR(sp, O_TMP_DIRECTORY));
  		if ((fd = mkstemp(tname)) == -1) {
  			msgq(sp, M_SYSERR,
  			    "237|Unable to create temporary file");
 
 Modified: head/contrib/nvi/common/options.c
 ==============================================================================
 --- head/contrib/nvi/common/options.c	Wed May 15 18:38:28 2013	(r250666)
 +++ head/contrib/nvi/common/options.c	Wed May 15 18:41:49 2013	(r250667)
 @@ -64,7 +64,7 @@ OPTLIST const optlist[] = {
  	{"columns",	f_columns,	OPT_NUM,	OPT_NOSAVE},
  /* O_COMMENT	  4.4BSD */
  	{"comment",	NULL,		OPT_0BOOL,	0},
 -/* O_DIRECTORY	    4BSD */
 +/* O_TMP_DIRECTORY  4BSD */
  	{"directory",	NULL,		OPT_STR,	0},
  /* O_EDCOMPATIBLE   4BSD */
  	{"edcompatible",NULL,		OPT_0BOOL,	0},
 @@ -244,7 +244,7 @@ static OABBREV const abbrev[] = {
  	{"aw",		O_AUTOWRITE},		/*     4BSD */
  	{"bf",		O_BEAUTIFY},		/*     4BSD */
  	{"co",		O_COLUMNS},		/*   4.4BSD */
 -	{"dir",		O_DIRECTORY},		/*     4BSD */
 +	{"dir",		O_TMP_DIRECTORY},	/*     4BSD */
  	{"eb",		O_ERRORBELLS},		/*     4BSD */
  	{"ed",		O_EDCOMPATIBLE},	/*     4BSD */
  	{"ex",		O_EXRC},		/* System V (undocumented) */
 @@ -347,7 +347,7 @@ opts_init(sp, oargs)
  	 */
  	(void)snprintf(b1, sizeof(b1),
  	    "directory=%s", (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s);
 -	OI(O_DIRECTORY, b1);
 +	OI(O_TMP_DIRECTORY, b1);
  	OI(O_ESCAPETIME, "escapetime=6");
  	OI(O_KEYTIME, "keytime=6");
  	OI(O_MATCHTIME, "matchtime=7");
 
 Modified: head/contrib/nvi/include/options_def.h
 ==============================================================================
 --- head/contrib/nvi/include/options_def.h	Wed May 15 18:38:28 2013	(r250666)
 +++ head/contrib/nvi/include/options_def.h	Wed May 15 18:41:49 2013	(r250667)
 @@ -8,7 +8,7 @@
  #define O_CEDIT 7
  #define O_COLUMNS 8
  #define O_COMMENT 9
 -#define O_DIRECTORY 10
 +#define O_TMP_DIRECTORY 10
  #define O_EDCOMPATIBLE 11
  #define O_ESCAPETIME 12
  #define O_ERRORBELLS 13
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
