1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

enable pledge(2) in rain(6)

it is libcurses program: at init it needs "stdio rpath getpw tty", and after
drop to just "stdio tty". "tty" is needed at end for restoring the tty.

initial patch from doug@
ok doug@ deraadt@
This commit is contained in:
semarie 2015-10-14 07:19:23 +00:00
parent 9ae4abf6fc
commit 20b80e920a

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rain.c,v 1.17 2013/08/29 20:22:18 naddy Exp $ */
/* $OpenBSD: rain.c,v 1.18 2015/10/14 07:19:23 semarie Exp $ */
/*
* Copyright (c) 1980, 1993
@ -61,6 +61,9 @@ main(int argc, char *argv[])
int ch;
int xpos[5], ypos[5];
if (pledge("stdio rpath getpw tty", NULL) == -1)
err(1, "pledge");
/* set default delay based on terminal baud rate */
if (tcgetattr(STDOUT_FILENO, &term) == 0 &&
(speed = cfgetospeed(&term)) > B9600)
@ -85,6 +88,10 @@ main(int argc, char *argv[])
timespecadd(&sleeptime, &sleeptime, &sleeptime);
initscr();
if (pledge("stdio tty", NULL) == -1)
err(1, "pledge");
tcols = COLS - 4;
tlines = LINES - 4;