aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-05-24 13:49:29 +0200
committerWynn Wolf Arbor2020-05-24 14:05:54 +0200
commit53b11e33a3c95301a2849410a9d01ef1d44d2038 (patch)
tree42c9469fcbedd39c4aeb4a7bf14290e7192dde0e
parent2ca0c5e6f60a7814d3e84e2baa43b55ba6f5304d (diff)
downloadslowcgi-53b11e33a3c95301a2849410a9d01ef1d44d2038.tar.gz
Use pledge(2) only on OpenBSD
-rw-r--r--slowcgi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/slowcgi.c b/slowcgi.c
index 63e7c1a..660f95e 100644
--- a/slowcgi.c
+++ b/slowcgi.c
@@ -367,8 +367,10 @@ main(int argc, char *argv[])
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
lerr(1, "unable to revoke privs");
+#ifdef __OpenBSD__
if (pledge("stdio rpath unix proc exec", NULL) == -1)
lerr(1, "pledge");
+#endif
SLIST_INIT(&slowcgi_proc.requests);
event_init();
@@ -932,8 +934,10 @@ exec_cgi(struct request *c)
return;
case 0:
/* Child process */
+#ifdef __OpenBSD__
if (pledge("stdio rpath exec", NULL) == -1)
lerr(1, "pledge");
+#endif
close(s_in[0]);
close(s_out[0]);
close(s_err[0]);