From 20b80e920a6ec97d52b5f635447e01da57e14fb6 Mon Sep 17 00:00:00 2001 From: semarie Date: Wed, 14 Oct 2015 07:19:23 +0000 Subject: [PATCH] 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@ --- games/rain/rain.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/games/rain/rain.c b/games/rain/rain.c index 1e8960a5446..9d6beb79010 100644 --- a/games/rain/rain.c +++ b/games/rain/rain.c @@ -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; -- 2.20.1