[hackers] [st] code-style for pledge(2) || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 25 May 2018 13:05:02 +0200 (CEST)

commit 235a783e039986fca3ccefec08ea45804dab196f
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri May 25 13:04:09 2018 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Fri May 25 13:04:09 2018 +0200

    code-style for pledge(2)
    
    feedback from Klemens, thanks

diff --git a/st.c b/st.c
index b9750f2..76bb3ea 100644
--- a/st.c
+++ b/st.c
_AT_@ -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
_AT_@ -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);
Received on Fri May 25 2018 - 13:05:02 CEST

This archive was generated by hypermail 2.3.0 : Fri May 25 2018 - 13:12:31 CEST