summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAshe Connor <ashe@kivikakk.ee>2018-11-21 13:34:07 +1100
committerAshe Connor <ashe@kivikakk.ee>2018-11-21 07:28:30 +1100
commit0d6062b80621cd52500b69c3fc0f1018e9aba7ad (patch)
tree6f48f10c4861c8240c170ebe735e81a94bcb97d4 /src
parent65110289fa5c284883bea92ed72d2bfcdfb761ba (diff)
check for OpenBSD 5.9+
Diffstat (limited to 'src')
-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;