diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2005-04-03 12:25:00 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2005-04-03 12:25:00 +0000 |
commit | 78e910cbfe90829be1d670540b8e8df9c9ce83c0 (patch) | |
tree | b10048c10b706dca08fc18b7e7ad67d215e79de5 | |
parent | 36679c2e4915dbb6fd442d518074401c0e9dfe00 (diff) |
Cleanup.
-rw-r--r-- | usr.sbin/sasyncd/sasyncd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/sasyncd/sasyncd.c b/usr.sbin/sasyncd/sasyncd.c index fcd313c55f4..2c8fd3cdefe 100644 --- a/usr.sbin/sasyncd/sasyncd.c +++ b/usr.sbin/sasyncd/sasyncd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sasyncd.c,v 1.3 2005/04/03 12:03:43 ho Exp $ */ +/* $OpenBSD: sasyncd.c,v 1.4 2005/04/03 12:24:59 ho Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -43,7 +43,7 @@ #include "sasyncd.h" -static int +static void privdrop(void) { struct passwd *pw = getpwnam(SASYNCD_USER); @@ -64,8 +64,6 @@ privdrop(void) log_err("%s: failed to drop privileges", __progname); exit(1); } - - return 0; } volatile int daemon_shutdown = 0; @@ -166,6 +164,12 @@ main(int argc, char **argv) if (r) return 1; + if (geteuid() != 0) { + /* No point in continuing. */ + fprintf(stderr, "This daemon needs to be run as root.\n"); + return 1; + } + if (carp_init()) return 1; if (pfkey_init(0)) |