about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--client.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/client.c b/client.c
index a16c682..8e5d2f2 100644
--- a/client.c
+++ b/client.c
@@ -681,6 +681,7 @@ static void readInput(void) {
 }
 
 int main(int argc, char *argv[]) {
+	int error;
 	const char *sockPath = DefaultSockPath;
 	int opt;
 	while (0 < (opt = getopt(argc, argv, "hs:"))) {
@@ -695,6 +696,12 @@ int main(int argc, char *argv[]) {
 	}
 
 	curse();
+
+#ifdef __OpenBSD__
+	error = pledge("stdio tty unix", NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 	modeHelp();
 	readInput();
 
@@ -703,9 +710,14 @@ int main(int argc, char *argv[]) {
 
 	struct sockaddr_un addr = { .sun_family = AF_LOCAL };
 	snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", sockPath);
-	int error = connect(client, (struct sockaddr *)&addr, SUN_LEN(&addr));
+	error = connect(client, (struct sockaddr *)&addr, SUN_LEN(&addr));
 	if (error) err(EX_NOINPUT, "%s", sockPath);
 
+#ifdef __OpenBSD__
+	error = pledge("stdio tty", NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 #ifdef __FreeBSD__
 	error = cap_enter();
 	if (error) err(EX_OSERR, "cap_enter");