about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-01 14:47:32 -0500
committerJune McEnroe <june@causal.agency>2021-02-01 14:47:32 -0500
commit8bd0b51140f24f253e8da91112a5e44b53837964 (patch)
treec1022ec85e1759b6436091c96f9e817300012f39
parentRemove use of "%n" (diff)
downloadcatsit-8bd0b51140f24f253e8da91112a5e44b53837964.tar.gz
catsit-8bd0b51140f24f253e8da91112a5e44b53837964.zip
Drop pledge privileges after daemonization 1.2
-rw-r--r--daemon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/daemon.c b/daemon.c
index 59215f6..f36e277 100644
--- a/daemon.c
+++ b/daemon.c
@@ -307,6 +307,11 @@ int main(int argc, char *argv[]) {
 		if (len < 0) syslog(LOG_WARNING, "%s: %m", pidPath);
 	}
 
+#ifdef __OpenBSD__
+	error = pledge("stdio cpath rpath proc exec id", NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 	signal(SIGHUP, signalHandler);
 	signal(SIGINT, signalHandler);
 	signal(SIGTERM, signalHandler);