tpledge(2) remaining programs and unify pledge error message - granular - granu… | |
git clone git://src.adamsgaard.dk/granular | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit d98aa161b5f8b62dbbe214ac9dcc3d0c252e8da8 | |
parent a27c1b04e4068db47900c00de2824bf06edb6a1b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 31 Aug 2021 10:20:12 +0200 | |
pledge(2) remaining programs and unify pledge error message | |
Diffstat: | |
M granular.c | 2 +- | |
M granular2vtu.c | 2 +- | |
M granularenergy.c | 2 +- | |
M granulargrain.c | 6 ++++++ | |
M granularpacking.c | 6 ++++++ | |
5 files changed, 15 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/granular.c b/granular.c | |
t@@ -28,7 +28,7 @@ main(int argc, char *argv[]) | |
#ifdef __OpenBSD__ | |
if (pledge("stdio wpath cpath", NULL) == -1) | |
- err(2, "pledge failed"); | |
+ err(2, "pledge"); | |
#endif | |
sim_defaults(&sim); | |
diff --git a/granular2vtu.c b/granular2vtu.c | |
t@@ -10,7 +10,7 @@ main(void) | |
#ifdef __OpenBSD__ | |
if (pledge("stdio", NULL) == -1) | |
- err(2, "pledge failed"); | |
+ err(2, "pledge"); | |
#endif | |
sim_read_grains(&sim, stdin); | |
diff --git a/granularenergy.c b/granularenergy.c | |
t@@ -10,7 +10,7 @@ main(void) | |
#ifdef __OpenBSD__ | |
if (pledge("stdio", NULL) == -1) | |
- err(2, "pledge failed"); | |
+ err(2, "pledge"); | |
#endif | |
sim_read_grains(&sim, stdin); | |
diff --git a/granulargrain.c b/granulargrain.c | |
t@@ -1,5 +1,6 @@ | |
#include <stdlib.h> | |
#include <err.h> | |
+#include <unistd.h> | |
#include "granular.h" | |
#include "arg.h" | |
t@@ -26,6 +27,11 @@ main(int argc, char *argv[]) | |
{ | |
struct grain g = grain_new(); | |
+#ifdef __OpenBSD__ | |
+ if (pledge("stdio", NULL) == -1) | |
+ err(2, "pledge"); | |
+#endif | |
+ | |
ARGBEGIN { | |
case 'd': | |
g.diameter = atof(EARGF(usage())); | |
diff --git a/granularpacking.c b/granularpacking.c | |
t@@ -1,5 +1,6 @@ | |
#include <stdlib.h> | |
#include <err.h> | |
+#include <unistd.h> | |
#include "granular.h" | |
#include "arg.h" | |
t@@ -33,6 +34,11 @@ main(int argc, char *argv[]) | |
int packing = 0; | |
double (*sizefunc)(double min, double max) = random_value_uniform; | |
+#ifdef __OpenBSD__ | |
+ if (pledge("stdio", NULL) == -1) | |
+ err(2, "pledge") | |
+#endif | |
+ | |
ARGBEGIN { | |
case 'D': | |
d_max = atof(EARGF(usage())); |