commit 0d996ecff96585f20aefe1c264b87b4d3b8ae865
parent 2ed8329a2d9dcb90c17b06e2d91b84482b00bb0c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 7 Aug 2020 14:06:57 +0200
add OpenBSD pledge support
Pledge / promise for the program to be able to do the following:
- Read and execute permissable files on the file-system.
- pledge:
- stdio, rpath: read and write stdio, read-only files.
- tty: read-write access the tty and query information (ioctl).
- proc: fork(), for fork+exec.
- exec: exec the plumber, piper (and shell for popen).
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1675,6 +1675,11 @@ main(int argc, char *argv[])
int ch, button, fd, x, y, release;
off_t off;
+#ifdef __OpenBSD__
+ if (pledge("stdio rpath tty proc exec", NULL) == -1)
+ err(1, "pledge");
+#endif
+
setlocale(LC_CTYPE, "");
if ((tmp = getenv("SFEED_PLUMBER")))