Index | Thread | Search

From:
Theo Buehler <tb@openbsd.org>
Subject:
Re: games/nblood diff for stdio opaque
To:
YASUOKA Masahiko <yasuoka@openbsd.org>
Cc:
jsg@jsg.id.au, ports@openbsd.org
Date:
Tue, 15 Jul 2025 09:08:46 +0200

Download raw body.

Thread
On Tue, Jul 15, 2025 at 02:18:19PM +0900, YASUOKA Masahiko wrote:
> On Tue, 15 Jul 2025 11:50:43 +1000
> Jonathan Gray <jsg@jsg.id.au> wrote:
> > On Tue, Jul 15, 2025 at 10:23:00AM +0900, YASUOKA Masahiko wrote:
> >> Hi,
> >> 
> >> A fix like the diff following is needed after stdio opaque diff.  The
> >> diff can be applied in advance.
> >> 
> >> ok?
> > 
> > Shouldn't this also change REVISION?
> 
> Yes.  The diffs cause a functionally change to the program.
> I updated the diff
> 

> +@@ -872,9 +872,11 @@ void maybe_redirect_outputs(void)
> +     if (fp)
> +     {
> +         setvbuf(fp, 0, _IONBF, 0);
> +-        *stdout = *fp;
> +-        *stderr = *fp;
> +     }
> ++
> ++    fp = freopen("stdout.txt", "w", stderr);
> ++    if (fp)
> ++        setvbuf(fp, 0, _IONBF, 0);

I don't see a good way of solving this right now, but does this not
leak a FILE *?

Maybe it's not a problem if the function is only called once.