diff options
author | Fabio M. Di Nitto <fdinitto@redhat.com> | 2010-08-12 09:14:59 +0000 |
---|---|---|
committer | Fabio M. Di Nitto <fdinitto@redhat.com> | 2010-08-12 09:14:59 +0000 |
commit | 2565ffad25808c25cbf5509e8c5ffc2a1c05671f (patch) | |
tree | 473db1922fdd3d4d297670eb075c01cf97ea54df /scripts/clvmd_init_red_hat.in | |
parent | 9ac9e06b5c4d5684248e0c117428f5ccafb40377 (diff) | |
download | lvm2-2565ffad25808c25cbf5509e8c5ffc2a1c05671f.tar.gz lvm2-2565ffad25808c25cbf5509e8c5ffc2a1c05671f.tar.xz lvm2-2565ffad25808c25cbf5509e8c5ffc2a1c05671f.zip |
Fix clvmd init script return code when executed as non-root user.
clvmd daemon itself does the right thing when invoked as non-root, by
returning 4.
The patch removes the use daemon function from
/etc/rc.d/init.d/functions that´s unnecessary and has th bad habit to
mask the return codes from the real daemon.
Add a simple and generic check to see if clvmd is executed by root or not.
Our stop/reload/restart paths in the init script are complex and not all
the tools involved in the process are guaranteed to return 4 if executed
by non-root against a process that´s running as root (for example kill
-TERM will return -1 and parsing the output to catch the error is
suboptimal at best).
https://bugzilla.redhat.com/show_bug.cgi?id=553381
Diffstat (limited to 'scripts/clvmd_init_red_hat.in')
-rw-r--r-- | scripts/clvmd_init_red_hat.in | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/clvmd_init_red_hat.in b/scripts/clvmd_init_red_hat.in index da09a345..b1cc48ed 100644 --- a/scripts/clvmd_init_red_hat.in +++ b/scripts/clvmd_init_red_hat.in @@ -66,7 +66,7 @@ start() { if ! rh_status_q; then echo -n "Starting $DAEMON: " - daemon $DAEMON $CLVMDOPTS || return $? + $DAEMON $CLVMDOPTS || return $? echo fi @@ -165,6 +165,11 @@ restart() { fi } +[ "$EUID" != "0" ] && { + echo "clvmd init script can only be executed as root user" + exit 4 +} + # See how we were called. case "$1" in start) |