if both stdout and stderr are redirected to a non-tty, pledge(2) will kill
authormestre <mestre@openbsd.org>
Sat, 23 Oct 2021 11:22:48 +0000 (11:22 +0000)
committermestre <mestre@openbsd.org>
Sat, 23 Oct 2021 11:22:48 +0000 (11:22 +0000)
commitbda84ce940729ea62ecb251ada05533d1b1163fc
tree28548a7758a5692df83ba80ddc8c2e768c539d8f
parent7890901f35be8a02c3f9c8de5fc45d7d28ded26a
if both stdout and stderr are redirected to a non-tty, pledge(2) will kill
ncurses applications, e.g.:

/usr/games/worms 2>&1 | cat

solve this by only calling pledge(2) after initscr(3) is set and done, or
whatever function that calls it. since pledge(2) is called later now the
promises might be reduced, but this a diff for another day.

found by naddy@ almost a year ago, discussed with him deraadt@ and tb@
ok tb@
13 files changed:
games/atc/main.c
games/backgammon/backgammon/main.c
games/battlestar/battlestar.c
games/boggle/boggle/bog.c
games/bs/bs.c
games/cribbage/crib.c
games/gomoku/main.c
games/grdc/grdc.c
games/hangman/main.c
games/mille/mille.c
games/rain/rain.c
games/robots/main.c
games/worms/worms.c