summaryrefslogtreecommitdiff
path: root/usr.sbin/rwhod
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-11-14 21:36:38 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-11-14 21:36:38 +0000
commit1988785ad23b0f3388c4bd36215e8a2ea7b4e047 (patch)
tree67bac0b4b005c5442721d596db770a2a4246f59c /usr.sbin/rwhod
parent3dd97dec84b765ef848392e9b4d693133b00f349 (diff)
Move call to daemon() after chdir() so any error message printed
on chdir error doesn't go to /dev/null; Janjaap van Velthooven
Diffstat (limited to 'usr.sbin/rwhod')
-rw-r--r--usr.sbin/rwhod/rwhod.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index 11a1ed94f78..d73d0eb3ee0 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: rwhod.c,v 1.17 2001/03/31 20:07:56 fgsch Exp $";
+static char rcsid[] = "$OpenBSD: rwhod.c,v 1.18 2001/11/14 21:36:37 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -157,14 +157,14 @@ main(argc, argv)
fprintf(stderr, "rwhod: udp/who: unknown service\n");
exit(1);
}
- if (!debug)
- daemon(1, 0);
-
if (chdir(_PATH_RWHODIR) < 0) {
(void)fprintf(stderr, "rwhod: %s: %s\n",
_PATH_RWHODIR, strerror(errno));
exit(1);
}
+ if (!debug)
+ daemon(1, 0);
+
(void) signal(SIGHUP, hup);
openlog("rwhod", LOG_PID, LOG_DAEMON);
/*