[hackers] [dmenu] Pledge on OpenBSD || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 25 May 2018 12:04:43 +0200 (CEST)

commit cd132c8d5b17ac2f4a3e611836d4cde4995d7a0c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri May 25 12:04:22 2018 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Fri May 25 12:04:22 2018 +0200

    Pledge on OpenBSD

diff --git a/dmenu.c b/dmenu.c
index d764658..7745947 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -24,6 +24,12 @@
 #define LENGTH(X) (sizeof X / sizeof X[0])
 #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
 
+#ifdef __OpenBSD__
+#include <unistd.h>
+#else
+#define pledge(a,b) 0
+#endif
+
 /* enums */
 enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
 
_AT_@ -746,6 +752,9 @@ main(int argc, char *argv[])
                 die("no fonts could be loaded.");
         lrpad = drw->fonts->h;
 
+ if (pledge("stdio rpath", NULL) < 0)
+ die("pledge");
+
         if (fast) {
                 grabkeyboard();
                 readstdin();
Received on Fri May 25 2018 - 12:04:43 CEST

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