From owner-cvs-all Thu Mar 7 7:59:55 2002 Delivered-To: cvs-all@freebsd.org Received: from ns.yogotech.com (ns.yogotech.com [206.127.123.66]) by hub.freebsd.org (Postfix) with ESMTP id D098637B404; Thu, 7 Mar 2002 07:59:40 -0800 (PST) Received: from caddis.yogotech.com (caddis.yogotech.com [206.127.123.130]) by ns.yogotech.com (8.9.3/8.9.3) with ESMTP id IAA21053; Thu, 7 Mar 2002 08:59:39 -0700 (MST) (envelope-from nate@yogotech.com) Received: (from nate@localhost) by caddis.yogotech.com (8.11.6/8.11.6) id g27FxdR49204; Thu, 7 Mar 2002 08:59:39 -0700 (MST) (envelope-from nate) From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15495.36458.825910.324111@caddis.yogotech.com> Date: Thu, 7 Mar 2002 08:59:38 -0700 To: Mark Murray Cc: obrien@FreeBSD.org, Mark Murray , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/rwall rwall.c In-Reply-To: <200203071210.g27CA8RV010023@grimreaper.grondar.org> References: <20020307033328.A64158@dragon.nuxi.com> <200203071210.g27CA8RV010023@grimreaper.grondar.org> X-Mailer: VM 6.96 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid Reply-To: nate@yogotech.com (Nate Williams) 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, Mar 07, 2002 at 11:27:02AM +0000, Mark Murray wrote: > > > > - if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+"))) > > > > + fd = mkstemp(tmpname); > > > > + fp = fdopen(fd, "r+"); > > > > + if (fd == -1 || !fp) > > > > > > > > Why did you need to do such code restructuring? > > > > > > "Assignment statement in conditional". I also happens to be more readable. > > > > Feh. Please back this type of changes out. The logic is not the same > > before and after. > > Here is the clearer fix: > > @@ -137,8 +136,10 @@ > > snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP); > fd = mkstemp(tmpname); > - fp = fdopen(fd, "r+"); > - if (fd == -1 || !fp) > + fp = NULL; > + if (fd != -1) > + fp = fdopen(fd, "r+"); > + if (fp == NULL) > err(1, "can't open temporary file"); > unlink(tmpname); I would argue the original code is *much* clearer. Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message