tAdd pledge(2) on OpenBSD - cngf-pf - continuum model for granular flows with pore-pressure dynamics (renamed from 1d_fd_simple_shear) (HTM) git clone git://src.adamsgaard.dk/cngf-pf (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit c69ce5e644c9313ff845d2798fa9a73b6c943d06 (DIR) parent fac32c7a7febb4dcc3aea5968ee0255046f60ccc (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk> 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(-) --- (DIR) 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();