tcode-style for pledge(2) - st - [fork] customized build of st, the simple terminal
(HTM) git clone git://src.adamsgaard.dk/st
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 235a783e039986fca3ccefec08ea45804dab196f
(DIR) parent 30ce2cc002585409b36c630512c6ca4db8f88f15
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 25 May 2018 13:04:09 +0200
code-style for pledge(2)
feedback from Klemens, thanks
Diffstat:
M st.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/st.c b/st.c
t@@ -28,10 +28,6 @@
#include <libutil.h>
#endif
-#ifndef __OpenBSD__
-#define pledge(a,b) 0
-#endif
-
/* Arbitrary sizes */
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
t@@ -810,13 +806,17 @@ ttynew(char *line, char *cmd, char *out, char **args)
die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
close(s);
close(m);
+#ifdef __OpenBSD__
if (pledge("stdio getpw proc exec", NULL) == -1)
die("pledge\n");
+#endif
execsh(cmd, args);
break;
default:
+#ifdef __OpenBSD__
if (pledge("stdio rpath tty proc", NULL) == -1)
die("pledge\n");
+#endif
close(s);
cmdfd = m;
signal(SIGCHLD, sigchld);