tAdd pledge(2) on OpenBSD - cngf-pf - continuum model for granular flows with p… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c69ce5e644c9313ff845d2798fa9a73b6c943d06 | |
parent fac32c7a7febb4dcc3aea5968ee0255046f60ccc | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 13 Nov 2019 16:16:33 +0100 | |
Add pledge(2) on OpenBSD | |
Diffstat: | |
M main.c | 7 +++++++ | |
1 file changed, 7 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/main.c b/main.c | |
t@@ -1,3 +1,4 @@ | |
+#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
t@@ -140,6 +141,12 @@ main(int argc, char* argv[]) | |
unsigned long iter, stressiter; | |
double new_phi, new_k, filetimeclock, res_norm, mu_wall_orig; | |
+#ifdef __OpenBSD__ | |
+ if (pledge("stdio", NULL) == -1) | |
+ fprintf(stderr, "error: pledge failed"); | |
+ exit(1); | |
+#endif | |
+ | |
/* load with default values */ | |
sim = init_sim(); | |