summaryrefslogtreecommitdiff
path: root/usr.sbin/apmd/apmd.c
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-04-21 06:45:05 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-04-21 06:45:05 +0000
commita9d1ecb55491700a43f19b317ca375420b2c2ccd (patch)
tree3af7935909f7c2f542edcb72f14930edd795cd83 /usr.sbin/apmd/apmd.c
parente98d69b14dd08856abde29fb967f9eb1c845bb3a (diff)
daemon() can fail; don't hide this for the user if that's the case.
ok otto@
Diffstat (limited to 'usr.sbin/apmd/apmd.c')
-rw-r--r--usr.sbin/apmd/apmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 0435a1c89fe..5a65d9702c7 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.56 2010/04/02 04:12:46 deraadt Exp $ */
+/* $OpenBSD: apmd.c,v 1.57 2011/04/21 06:45:04 jasper Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -568,7 +568,8 @@ main(int argc, char *argv[])
if (debug)
openlog(__progname, LOG_CONS, LOG_LOCAL1);
else {
- daemon(0, 0);
+ if (daemon(0, 0) < 0)
+ error("failed to daemonize", NULL);
openlog(__progname, LOG_CONS, LOG_DAEMON);
setlogmask(LOG_UPTO(LOG_NOTICE));
}