about summary refs log tree commit diff
path: root/clipnotify.c
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2018-10-31 08:23:25 +0000
committerChris Down <chris@chrisdown.name>2018-10-31 08:23:25 +0000
commiteb156445572bad2eec7ac6f2dd7cd21d2eaaca6e (patch)
treec2697db8cd4b616a7667aae2db0e05d15d8475ef /clipnotify.c
parent18a36bc57c77e88b684da0485510fd69ae47b593 (diff)
downloadclipbuzz-eb156445572bad2eec7ac6f2dd7cd21d2eaaca6e.tar.gz
Add MAYBE_PLEDGE for OpenBSD
Diffstat (limited to 'clipnotify.c')
-rw-r--r--clipnotify.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/clipnotify.c b/clipnotify.c
index f09583e..e0440b3 100644
--- a/clipnotify.c
+++ b/clipnotify.c
@@ -4,12 +4,23 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef __OpenBSD__
+#define MAYBE_PLEDGE(p, ep) pledge(p, ep)
+#else
+#define MAYBE_PLEDGE(p, ep) 0
+#endif /* __OpenBSD__ */
+
 int main(void) {
     Display *disp;
     Window root;
     Atom clip;
     XEvent evt;
 
+    if (MAYBE_PLEDGE("stdio rpath", NULL) < 0) {
+        perror("pledge");
+        exit(2);
+    }
+
     disp = XOpenDisplay(NULL);
     if (!disp) {
         fprintf(stderr, "Can't open X display\n");