From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 26 04:20:00 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0450242 for ; Mon, 26 Nov 2012 04:20:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id A56828FC0C for ; Mon, 26 Nov 2012 04:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ4K0i2093829 for ; Mon, 26 Nov 2012 04:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qAQ4K0e4093826; Mon, 26 Nov 2012 04:20:00 GMT (envelope-from gnats) Resent-Date: Mon, 26 Nov 2012 04:20:00 GMT Resent-Message-Id: <201211260420.qAQ4K0e4093826@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D62EEF for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/173924: [patch] import upstream nvi -Wshadow O_DIRECTORY fix X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 04:20:01 -0000 >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@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 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: