]> datadissipation.net git - ust.git/commitdiff
add OpenBSD pledge support
authorgit <redacted>
Thu, 19 Mar 2026 21:45:39 +0000 (17:45 -0400)
committergit <redacted>
Thu, 19 Mar 2026 21:45:39 +0000 (17:45 -0400)
ust.c

diff --git a/ust.c b/ust.c
index 392bc439a08122db374a5c29bb61919516adfec9..8be0ce784d782fbf5dda33fd0fd3c190e4d6024b 100644 (file)
--- a/ust.c
+++ b/ust.c
@@ -143,6 +143,13 @@ openport(void)
        int flags;
        struct flock fl = { 0 };
 
+       #ifdef __OpenBSD__
+        if (pledge("stdio rpath wpath tty flock", NULL) == -1) {
+                 perror("pledge");
+                 die(1, "failed to set up pledge, exiting now\n");
+        }
+       #endif
+
        if (verbose) fprintf(stderr, "opening \"%s\"\n", line);
 
        fd = open(line, (O_RDWR | O_NOCTTY | O_NDELAY));