"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
"Todd C. Miller" <millert@openbsd.org>
Subject:
Re: simplify got_gotweb_openfile/flushfile
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 15 May 2023 13:08:38 -0600

Download raw body.

Thread
On Mon, 15 May 2023 17:44:41 +0200, Omar Polo wrote:

> it's a bit confusing to follow some parts due to all the various fN
> and fdN variable involved.  Furthermore, we don't need to return both
> the FILE* and the file descriptor number in got_gotweb_openfile(),
> just the former is enough.
>
> Removing this "tuple" of FILE* and fd allows to make more easy to spot
> what's going on.

Yes, this is an improvement.

> I'll rename the various fdN in a follow up commit, otherwise diff
> below would have been unreadable.  I'll also follow up to with a
> change for got_gotweb_flushfile() to always close the file.  and to
> log eventual close() errors in gotweb_free_transport() too.

When you do this, maybe consider renaming got_gotweb_flushfile()
to got_gotweb_closefile().

 - todd