Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 13:19:35 +0100 (CET)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        Mark Murray <mark@grondar.za>
Cc:        obrien@FreeBSD.ORG, Mark Murray <markm@FreeBSD.ORG>, <cvs-committers@FreeBSD.ORG>, <cvs-all@FreeBSD.ORG>
Subject:   Re: cvs commit: src/usr.bin/rwall rwall.c 
Message-ID:  <20020307131720.V99061-100000@beagle.fokus.gmd.de>
In-Reply-To: <200203071210.g27CA8RV010023@grimreaper.grondar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020307131720.V99061-100000>