File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 7
7
#include "cmark.h"
8
8
#include "node.h"
9
9
10
+ #if defined(__OpenBSD__ )
11
+ # include <sys/param.h>
12
+ # if OpenBSD >= 201605
13
+ # define USE_PLEDGE
14
+ # include <unistd.h>
15
+ # endif
16
+ #endif
17
+
10
18
#if defined(_WIN32 ) && !defined(__CYGWIN__ )
11
19
#include <io.h>
12
20
#include <fcntl.h>
@@ -77,6 +85,13 @@ int main(int argc, char *argv[]) {
77
85
writer_format writer = FORMAT_HTML ;
78
86
int options = CMARK_OPT_DEFAULT ;
79
87
88
+ #ifdef USE_PLEDGE
89
+ if (pledge ("stdio rpath" , NULL ) != 0 ) {
90
+ perror ("pledge" );
91
+ return 1 ;
92
+ }
93
+ #endif
94
+
80
95
#if defined(_WIN32 ) && !defined(__CYGWIN__ )
81
96
_setmode (_fileno (stdin ), _O_BINARY );
82
97
_setmode (_fileno (stdout ), _O_BINARY );
@@ -176,6 +191,13 @@ int main(int argc, char *argv[]) {
176
191
}
177
192
}
178
193
194
+ #ifdef USE_PLEDGE
195
+ if (pledge ("stdio" , NULL ) != 0 ) {
196
+ perror ("pledge" );
197
+ return 1 ;
198
+ }
199
+ #endif
200
+
179
201
document = cmark_parser_finish (parser );
180
202
cmark_parser_free (parser );
181
203
You can’t perform that action at this time.
0 commit comments