Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: games/nblood diff for stdio opaque
To:
YASUOKA Masahiko <yasuoka@openbsd.org>
Cc:
tb@openbsd.org, ports@openbsd.org
Date:
Tue, 15 Jul 2025 11:50:43 +1000

Download raw body.

Thread
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?

The nblood code is derived from eduke32.  games/eduke32 will need the
same patch.

> 
> Index: games/nblood/patches/patch-source_build_src_baselayer_cpp
> ===================================================================
> RCS file: games/nblood/patches/patch-source_build_src_baselayer_cpp
> diff -N games/nblood/patches/patch-source_build_src_baselayer_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ games/nblood/patches/patch-source_build_src_baselayer_cpp	15 Jul 2025 01:17:29 -0000
> @@ -0,0 +1,19 @@
> +Can't substitute a FILE object to std{out,err}.
> +
> +Index: source/build/src/baselayer.cpp
> +--- source/build/src/baselayer.cpp.orig
> ++++ source/build/src/baselayer.cpp
> +@@ -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);

It seems strange to not open "stderr.txt" here.

The patch maintains the old behaviour, so likely fine.

> ++    if (fp)
> ++        setvbuf(fp, 0, _IONBF, 0);
> + #endif
> + }
> + 
> 
>