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
This commit is contained in:
Theo Buehler
2016-01-14 10:06:34 +01:00
parent 9a4dbf366b
commit a1d1f456a1
4 changed files with 26 additions and 9 deletions

View File

@ -470,6 +470,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", NULL) == -1)
err(EXIT_FAILURE, "pledge");
#endif
xcb_rectangle_t win_pos = get_window_position();
xcb_cursor_t cursor;