$OpenBSD: patch-i3-nagbar_main_c,v 1.9 2016/01/26 09:42:35 dcoppa Exp $

commit a1d1f456a1fbf44bfa5c6a9d041023ac498b0c46
Author: Theo Buehler <theo@math.ethz.ch>
Date:   Thu Jan 14 10:06:34 2016 +0100

Add pledge(2) support for OpenBSD

pledges for i3:
"stdio rpath unix" for talking to the i3 socket usually in /tmp
"proc exec" for executing programs
"wpath cpath" are needed for the restart-in-place functionality

To make this work, @semarie pointed out that it is sufficient to ensure
that we get physical_mem_bytes only once, namely in init_logging().

pledges for i3-msg:
"stdio rpath unix" are needed for talking to the i3-socket

pledges for i3-nagbar
"rpath getpw" to find the home directory
"wpath cpath" to write the script
"proc exec" to execute the script
"unix" for talking to the i3 socket

--- i3-nagbar/main.c.orig	Wed Sep 30 08:55:10 2015
+++ i3-nagbar/main.c	Sun Dec 20 15:00:22 2015
@@ -170,7 +170,7 @@ static void handle_button_release(xcb_connection_t *co
     }
 
     char *terminal_cmd;
-    sasprintf(&terminal_cmd, "i3-sensible-terminal -e %s", link_path);
+    sasprintf(&terminal_cmd, "${X11BASE}/bin/xterm -e %s", link_path);
     printf("argv0 = %s\n", argv0);
     printf("terminal_cmd = %s\n", terminal_cmd);
 
@@ -464,6 +464,11 @@ int main(int argc, char *argv[]) {
 
     font = load_font(pattern, true);
     set_font(&font);
+
+#if defined(__OpenBSD__)
+    if (pledge("stdio rpath wpath cpath getpw proc exec unix", NULL) == -1)
+        err(EXIT_FAILURE, "pledge");
+#endif
 
     xcb_rectangle_t win_pos = get_window_position();
 
