diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2011-10-07 07:26:50 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2011-10-07 07:26:50 +0000 |
commit | 1979c4a83f8a62aaeef5782796282d7baf97af04 (patch) | |
tree | 1892bd0e230c3762fec357fca8d2f9e4b7fa5a24 | |
parent | 23657e8764b4adba55d19d0893b524408c59864c (diff) |
Check if we are root right from the start.
ok robert@
-rw-r--r-- | etc/rc.d/rc.subr | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index 56f82af565b..ac3c8b169f2 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.50 2011/10/07 07:17:25 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.51 2011/10/07 07:26:49 ajacoutot Exp $ # # Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -80,9 +80,6 @@ rc_wait() { } rc_cmd() { - [ $(id -u) -eq 0 ] || \ - rc_err "$0: need root privileges" - [ -z "${_RC_FORCE}" ] && [ X"${daemon_flags}" = X"NO" ] && exit 1 eval _enotsup=\${rc_${1}} @@ -142,6 +139,8 @@ rc_cmd() { esac } +[ $(id -u) -eq 0 ] || rc_err "$0: need root privileges" + [ -z "${local_rcconf}" ] && . /etc/rc.conf [ -n "${daemon}" ] || rc_err "$0: daemon is not set" |