Skip to content

Commit 0d6062b

Browse files
committed
check for OpenBSD 5.9+
1 parent 6511028 commit 0d6062b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
#include "node.h"
99

1010
#if defined(__OpenBSD__)
11-
#include <unistd.h>
11+
# include <sys/param.h>
12+
# if OpenBSD >= 201605
13+
# define USE_PLEDGE
14+
# include <unistd.h>
15+
# endif
1216
#endif
1317

1418
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -81,7 +85,7 @@ int main(int argc, char *argv[]) {
8185
writer_format writer = FORMAT_HTML;
8286
int options = CMARK_OPT_DEFAULT;
8387

84-
#if defined(__OpenBSD__)
88+
#ifdef USE_PLEDGE
8589
if (pledge("stdio rpath", NULL) != 0) {
8690
perror("pledge");
8791
return 1;
@@ -187,7 +191,7 @@ int main(int argc, char *argv[]) {
187191
}
188192
}
189193

190-
#if defined(__OpenBSD__)
194+
#ifdef USE_PLEDGE
191195
if (pledge("stdio", NULL) != 0) {
192196
perror("pledge");
193197
return 1;

0 commit comments

Comments
 (0)