From eb156445572bad2eec7ac6f2dd7cd21d2eaaca6e Mon Sep 17 00:00:00 2001 From: Chris Down Date: Wed, 31 Oct 2018 08:23:25 +0000 Subject: Add MAYBE_PLEDGE for OpenBSD --- clipnotify.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clipnotify.c b/clipnotify.c index f09583e..e0440b3 100644 --- a/clipnotify.c +++ b/clipnotify.c @@ -4,12 +4,23 @@ #include #include +#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"); -- cgit 1.4.1