summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 904df5e..1094fee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,7 +8,11 @@
#include "node.h"
#if defined(__OpenBSD__)
-#include <unistd.h>
+# include <sys/param.h>
+# if OpenBSD >= 201605
+# define USE_PLEDGE
+# include <unistd.h>
+# endif
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -81,7 +85,7 @@ int main(int argc, char *argv[]) {
writer_format writer = FORMAT_HTML;
int options = CMARK_OPT_DEFAULT;
-#if defined(__OpenBSD__)
+#ifdef USE_PLEDGE
if (pledge("stdio rpath", NULL) != 0) {
perror("pledge");
return 1;
@@ -187,7 +191,7 @@ int main(int argc, char *argv[]) {
}
}
-#if defined(__OpenBSD__)
+#ifdef USE_PLEDGE
if (pledge("stdio", NULL) != 0) {
perror("pledge");
return 1;