diff options
author | Ricardo Mestre <mestre@cvs.openbsd.org> | 2021-10-23 11:22:50 +0000 |
---|---|---|
committer | Ricardo Mestre <mestre@cvs.openbsd.org> | 2021-10-23 11:22:50 +0000 |
commit | ecd10c1195d7c68d97eb7d679f932aa85ba050a6 (patch) | |
tree | 208ed86a4aec6394b30e888b051761c4aa0e22b5 /games/backgammon | |
parent | d44be2f813bdce978e91422aa39bbc7e6f7466f1 (diff) |
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@
Diffstat (limited to 'games/backgammon')
-rw-r--r-- | games/backgammon/backgammon/main.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c index ebcbb725192..c8f9208da0b 100644 --- a/games/backgammon/backgammon/main.c +++ b/games/backgammon/backgammon/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.24 2017/07/11 14:32:16 fcambus Exp $ */ +/* $OpenBSD: main.c,v 1.25 2021/10/23 11:22:48 mestre Exp $ */ /* * Copyright (c) 1980, 1993 @@ -85,9 +85,6 @@ main (int argc, char **argv) int i,l; /* non-descript indices */ char c; /* non-descript character storage */ - if (pledge("stdio rpath wpath cpath tty exec", NULL) == -1) - err(1, "pledge"); - signal(SIGINT, getout); /* trap interrupts */ /* use whole screen for text */ @@ -107,6 +104,9 @@ main (int argc, char **argv) if (cturn == 0) rflag = 0; } else { + if (pledge("stdio rpath wpath cpath tty exec", NULL) == -1) + err(1, "pledge"); + rscore = wscore = 0; /* zero score */ if (aflag) { /* print rules */ |