Skip to content

Commit 42f5a52

Browse files
committed
check for OpenBSD 5.9+
1 parent 44eafe0 commit 42f5a52

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
@@ -14,7 +14,11 @@
1414
#include "../extensions/cmark-gfm-core-extensions.h"
1515

1616
#if defined(__OpenBSD__)
17-
#include <unistd.h>
17+
# include <sys/param.h>
18+
# if OpenBSD >= 201605
19+
# define USE_PLEDGE
20+
# include <unistd.h>
21+
# endif
1822
#endif
1923

2024
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -121,7 +125,7 @@ int main(int argc, char *argv[]) {
121125
int options = CMARK_OPT_DEFAULT;
122126
int res = 1;
123127

124-
#if defined(__OpenBSD__)
128+
#ifdef USE_PLEDGE
125129
if (pledge("stdio rpath", NULL) != 0) {
126130
perror("pledge");
127131
return 1;
@@ -275,7 +279,7 @@ int main(int argc, char *argv[]) {
275279
}
276280
}
277281

278-
#if defined(__OpenBSD__)
282+
#ifdef USE_PLEDGE
279283
if (pledge("stdio", NULL) != 0) {
280284
perror("pledge");
281285
return 1;

0 commit comments

Comments
 (0)