Date: Thu, 07 Mar 2002 12:10:08 +0000 From: Mark Murray <mark@grondar.za> To: obrien@FreeBSD.org Cc: Mark Murray <mark@grondar.za>, 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: <200203071210.g27CA8RV010023@grimreaper.grondar.org> In-Reply-To: <20020307033328.A64158@dragon.nuxi.com> ; from "David O'Brien" <obrien@FreeBSD.org> "Thu, 07 Mar 2002 03:33:28 PST." References: <20020307033328.A64158@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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); M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn 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?200203071210.g27CA8RV010023>