From 3731b2cd8583e13560f50a1542d62957a1c4d4b0 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Fri, 7 Oct 2011 07:26:49 +0000 Subject: [PATCH] Check if we are root right from the start. ok robert@ --- src/etc/rc.d/rc.subr | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/etc/rc.d/rc.subr b/src/etc/rc.d/rc.subr index 56f82af5..ac3c8b16 100644 --- a/src/etc/rc.d/rc.subr +++ b/src/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 # Copyright (c) 2010, 2011 Ingo Schwarze @@ -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"