[kexec-tools] Fix misuse of basename in mkdumprd

Neil Horman nhorman at fedoraproject.org
Mon Mar 28 15:09:19 UTC 2011


commit 678b7b882f645b4298f4eed33e9ee3217ca8ba5c
Author: Neil Horman <nhorman at tuxdriver.com>
Date:   Mon Mar 28 11:08:50 2011 -0400

    Fix misuse of basename in mkdumprd
    
    Resolves bz: 683769

 kexec-tools.spec |    5 ++++-
 mkdumprd         |   16 +++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 9dfdecb..3e6a94d 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -1,6 +1,6 @@
 Name: kexec-tools
 Version: 2.0.0 
-Release: 44%{?dist}
+Release: 45%{?dist}
 License: GPLv2
 Group: Applications/System
 Summary: The kexec/kdump userspace component.
@@ -282,6 +282,9 @@ done
 
 
 %changelog
+* Mon Mar 28 2011 Neil Horman <nhorman at redhat.com> - 2.0.0-45
+- Fix misuse of basename in mkdumprd (bz 683769)
+
 * Thu Mar 10 2011 Neil Horman <nhorman at redhat.com> - 2.0.0-44
 - Fix build break in purgatory makefile
 
diff --git a/mkdumprd b/mkdumprd
index 69146d0..26c5e2c 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -370,7 +370,9 @@ findstoragedriverinsys () {
         cd ..
     done
 
-    modalias=$(cat $(find /sys/devices -name modalias | grep $(basename $(readlink ./device))))
+    [ -e modalias ] && modalias=$(cat modalias)
+    [ -e device ] && modalias=$(cat $(find /sys/devices -name modalias
+        | grep $(basename $(readlink ./device))))
 
     for driver in $(modprobe --set-version $kernel --show-depends $modalias 2>/dev/null| awk '{ print gensub(".*/","","g",$2) }') ; do
         findmodule ${driver%%.ko}
@@ -1713,14 +1715,14 @@ for MODULE in $MODULES; do
     fullmodule=`echo $MODULE | sed "s|.*/||"`
 
     options=`sed -n -e "s/^options[ 	][ 	]*$module[ 	][ 	]*//p" $modulefile 2>/dev/null`
-    options2=`sed -n -e "s/^options[    ][      ]*$module[      ][      ]*//p" $KDUMP_CONFIG_FILE 2>/dev/null`
-
-    # Overwrite options if option is specified in kdump.conf
-    if [ -n "$options2" ]; then
-        options=$options2
+    if [ -f "$KDUMP_CONFIG_FILE" ]; then
+        options2=`sed -n -e "s/^options[    ][      ]*$module[      ][      ]*//p" $KDUMP_CONFIG_FILE 2>/dev/null`
+        # Overwrite options if option is specified in kdump.conf
+        if [ -n "$options2" ]; then
+            options=$options2
+        fi
     fi
 
-
     if [ -n "$options" ]; then
         vecho "Adding module $module$text with options $options"
     else


More information about the scm-commits mailing list