From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 1 11:55:42 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B9261065670 for ; Mon, 1 Dec 2008 11:55:42 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 5B5CB8FC13 for ; Mon, 1 Dec 2008 11:55:42 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 61AA86D44C; Mon, 1 Dec 2008 11:55:41 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 46ABF844A7; Mon, 1 Dec 2008 12:55:41 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Eitan Adler References: <49320FF7.4040901@gmail.com> <4932122A.8070209@delphij.net> <493214DC.2080904@gmail.com> Date: Mon, 01 Dec 2008 12:55:41 +0100 In-Reply-To: <493214DC.2080904@gmail.com> (Eitan Adler's message of "Sat, 29 Nov 2008 23:21:48 -0500") Message-ID: <86myfgqfcy.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, d@delphij.net Subject: Re: change to ee.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 11:55:42 -0000 Eitan Adler writes: > Xin LI writes: > > Tanks for interested in this but I'm afraid that your patch is > > incorrect. mkstemp returns a file descriptor rather than a string > > pointer, therefore, the subsequent open() would have undefined > > behavior. It looks like that we actually want fd =3D mkstemp() here. > Thanks. If this is the case how come gcc did not return any warnings? Because ee(1) is built with most warnings disabled, precisely because the source code is of such poor quality (by modern standards). Try this: $ cd /usr/src/usr.bin/ee $ make clean $ make WARNS=3D3 2>&1 | grep -cw warning 72 $ make WARNS=3D6 2>&1 | grep -cw warning=20 188 This is on amd64; you will get fewer on i386. Someone added casts to silence legitimate warnings about pointers being assigned to integers, so gcc will only complain about those assignments on platforms where sizeof(int) =3D=3D sizeof(void *). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no