summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client.c4
-rw-r--r--compat.h4
-rw-r--r--server.c2
-rw-r--r--tmux.c2
4 files changed, 4 insertions, 8 deletions
diff --git a/client.c b/client.c
index ea84d645..9be2934c 100644
--- a/client.c
+++ b/client.c
@@ -289,7 +289,6 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
ttynam = "";
-#ifdef __OpenBSD__
/*
* Drop privileges for client. "proc exec" is needed for -c and for
* locking (which uses system(3)).
@@ -301,7 +300,6 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
*/
if (pledge("stdio unix sendfd proc exec tty", NULL) != 0)
fatal("pledge failed");
-#endif
/* Free stuff that is not used in the client. */
if (ptm_fd != -1)
@@ -563,7 +561,6 @@ client_dispatch_wait(struct imsg *imsg, const char *shellcmd)
struct msg_stdout_data stdoutdata;
struct msg_stderr_data stderrdata;
int retval;
-#ifdef __OpenBSD__
static int pledge_applied;
/*
@@ -577,7 +574,6 @@ client_dispatch_wait(struct imsg *imsg, const char *shellcmd)
fatal("pledge failed");
pledge_applied = 1;
};
-#endif
data = imsg->data;
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
diff --git a/compat.h b/compat.h
index e1e11ec6..94c0c71e 100644
--- a/compat.h
+++ b/compat.h
@@ -58,6 +58,10 @@ typedef uint64_t u_int64_t;
#define _PATH_DEV "/dev/"
#endif
+#ifndef __OpenBSD__
+#define pledge(s, p) (0)
+#endif
+
#ifdef HAVE_QUEUE_H
#include <sys/queue.h>
#else
diff --git a/server.c b/server.c
index 1fbaf37c..fa2d1c81 100644
--- a/server.c
+++ b/server.c
@@ -148,11 +148,9 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
if (log_get_level() > 3)
tty_create_log();
-#ifdef __OpenBSD__
if (pledge("stdio rpath wpath cpath fattr unix getpw recvfd proc exec "
"tty ps", NULL) != 0)
fatal("pledge failed");
-#endif
RB_INIT(&windows);
RB_INIT(&all_window_panes);
diff --git a/tmux.c b/tmux.c
index 7f55f395..d0de6239 100644
--- a/tmux.c
+++ b/tmux.c
@@ -261,13 +261,11 @@ main(int argc, char **argv)
if (shellcmd != NULL && argc != 0)
usage();
-#ifdef __OpenBSD__
if (pty_open(&ptm_fd) != 0)
errx(1, "open(\"/dev/ptm\"");
if (pledge("stdio rpath wpath cpath flock fattr unix getpw sendfd "
"recvfd proc exec tty ps", NULL) != 0)
err(1, "pledge");
-#endif
/*
* tmux is a UTF-8 terminal, so if TMUX is set, assume UTF-8.