summaryrefslogtreecommitdiff
path: root/usr.sbin/slowcgi/slowcgi.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-08-19 12:31:42 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-08-19 12:31:42 +0000
commitc47a81e3448ee7f0cef25f2467b3720e9fb71a70 (patch)
tree53158b3c31d795c6192bfb296bc66487a06eac59 /usr.sbin/slowcgi/slowcgi.c
parent735770b58f019276010e01d884fe69cb4ac4f9e3 (diff)
Call daemon with 0 as first argument so that it changes the cwd to /.
It is not a problem in slowcgi since it calls chroot(2) and then chdir(2) shortly afterwards but hopefully prevents copying code into daemons where it does matter. Problem first observed by dlg in ntpd(8) which keeps sitting in the directory from where it was started which might for example prevent an unmount. Discussed with deraadt@
Diffstat (limited to 'usr.sbin/slowcgi/slowcgi.c')
-rw-r--r--usr.sbin/slowcgi/slowcgi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/slowcgi/slowcgi.c b/usr.sbin/slowcgi/slowcgi.c
index 8d8c970d861..696af7228f2 100644
--- a/usr.sbin/slowcgi/slowcgi.c
+++ b/usr.sbin/slowcgi/slowcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slowcgi.c,v 1.53 2018/08/13 16:54:50 florian Exp $ */
+/* $OpenBSD: slowcgi.c,v 1.54 2018/08/19 12:31:41 florian Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
* Copyright (c) 2013 Florian Obser <florian@openbsd.org>
@@ -323,7 +323,7 @@ main(int argc, char *argv[])
if (geteuid() != 0)
errx(1, "need root privileges");
- if (!debug && daemon(1, 0) == -1)
+ if (!debug && daemon(0, 0) == -1)
err(1, "daemon");
if (!debug) {