From owner-cvs-all Thu Mar 7 4:19:52 2002 Delivered-To: cvs-all@freebsd.org Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by hub.freebsd.org (Postfix) with ESMTP id 3167537B416; Thu, 7 Mar 2002 04:19:45 -0800 (PST) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id g27CJZR28691; Thu, 7 Mar 2002 13:19:40 +0100 (MET) Date: Thu, 7 Mar 2002 13:19:35 +0100 (CET) From: Harti Brandt To: Mark Murray Cc: obrien@FreeBSD.ORG, Mark Murray , , Subject: Re: cvs commit: src/usr.bin/rwall rwall.c In-Reply-To: <200203071210.g27CA8RV010023@grimreaper.grondar.org> Message-ID: <20020307131720.V99061-100000@beagle.fokus.gmd.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 7 Mar 2002, Mark Murray wrote: MM>> On Thu, Mar 07, 2002 at 11:27:02AM +0000, Mark Murray wrote: MM>> > > - if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+"))) MM>> > > + fd = mkstemp(tmpname); MM>> > > + fp = fdopen(fd, "r+"); MM>> > > + if (fd == -1 || !fp) MM>> > > MM>> > > Why did you need to do such code restructuring? MM>> > MM>> > "Assignment statement in conditional". I also happens to be more readable. MM>> MM>> Feh. Please back this type of changes out. The logic is not the same MM>> before and after. MM> MM>Here is the clearer fix: MM> MM>@@ -137,8 +136,10 @@ MM> MM> snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP); MM> fd = mkstemp(tmpname); MM>- fp = fdopen(fd, "r+"); MM>- if (fd == -1 || !fp) MM>+ fp = NULL; MM>+ if (fd != -1) MM>+ fp = fdopen(fd, "r+"); MM>+ if (fp == NULL) MM> err(1, "can't open temporary file"); MM> unlink(tmpname); This is by *NO* means more readable than the old code! harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message