From owner-p4-projects@FreeBSD.ORG Mon Jul 16 03:17:09 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3739016A407; Mon, 16 Jul 2007 03:17:09 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E39A316A400; Mon, 16 Jul 2007 03:17:08 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mxout7.cac.washington.edu (mxout7.cac.washington.edu [140.142.32.178]) by mx1.freebsd.org (Postfix) with ESMTP id C168F13C4BF; Mon, 16 Jul 2007 03:17:08 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.141] (may be forged)) by mxout7.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.06) with ESMTP id l6G3H89T029837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 15 Jul 2007 20:17:08 -0700 X-Auth-Received: from [192.168.10.45] (c-24-10-12-194.hsd1.ca.comcast.net [24.10.12.194]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l6G3H7Bj011257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 15 Jul 2007 20:17:07 -0700 Message-ID: <469AE332.5060007@gmail.com> Date: Sun, 15 Jul 2007 20:17:06 -0700 From: Garrett Cooper User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Garrett Cooper References: <200707160303.l6G33PoX000247@repoman.freebsd.org> In-Reply-To: <200707160303.l6G33PoX000247@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.2.304607, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.7.15.195333 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='FORGED_FROM_GMAIL 0.1, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FROM_GMAIL 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Cc: Perforce Change Reviews Subject: Re: PERFORCE change 123578 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2007 03:17:09 -0000 Garrett Cooper wrote: > http://perforce.freebsd.org/chv.cgi?CH=123578 > > Change 123578 by gcooper@optimus-revised_pkgtools on 2007/07/16 03:02:24 > > 2 mistakes. > -Make sure that fd isn't NULL, instead of NULL. > -It's not O_RDONLY, it's "r" for fopen. Funny why gcc didn't pick up that error... > > Affected files ... > > .. //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/file.c#7 edit > > Differences ... > > ==== //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/file.c#7 (text+ko) ==== > > @@ -195,9 +195,9 @@ > { > char *contents; > > - FILE *fd = fopen(fname, O_RDONLY); > + FILE *fd = fopen(fname, "r"); > > - if (fd != NULL) { > + if (fd == NULL) { > cleanup(0); > errx(2, "%s: unable to open '%s' for reading", __func__, fname); > } > > Of course.. O_RDONLY was being interpreted as NULL most likely since its decimal value's 0.. -Garrett