about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/client.c b/client.c
index bb2ee1b..4736261 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");