code-style for pledge(2)
authorHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 25 May 2018 11:04:09 +0000 (13:04 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 25 May 2018 11:04:09 +0000 (13:04 +0200)
feedback from Klemens, thanks

st.c

diff --git a/st.c b/st.c
index b9750f2..76bb3ea 100644 (file)
--- a/st.c
+++ b/st.c
  #include <libutil.h>
 #endif
 
-#ifndef __OpenBSD__
-#define pledge(a,b) 0
-#endif
-
 /* Arbitrary sizes */
 #define UTF_INVALID   0xFFFD
 #define UTF_SIZ       4
@@ -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);