]> sourceware.org Git - lvm2.git/commitdiff
Fix clvmd init script return code when executed as non-root user.
authorFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 12 Aug 2010 09:14:59 +0000 (09:14 +0000)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 12 Aug 2010 09:14:59 +0000 (09:14 +0000)
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

WHATS_NEW
scripts/clvmd_init_red_hat.in

index b885df283bc3e0d81489ac01dc56784ac51ce383..205ce34a947091d0f63b9a3fb6b063f7c2628215 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.73 - 
 ================================
+  Fix clvmd init script exit code when executed as non-root user.
   Change default alignment of pe_start to 1MB.
   Add --norestorefile option to pvcreate.
   Require --restorefile when using pvcreate --uuid.
index da09a3453ade8a4b188597885bed0fb47a6690bc..b1cc48ed2e77b6115cbf507f71b104170281d6f6 100644 (file)
@@ -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)
This page took 0.040554 seconds and 5 git commands to generate.