[kexec-tools/f18] Optimize redundent code fetching server of network dump

Dave Young yangrr at fedoraproject.org
Fri Dec 14 09:24:56 UTC 2012


commit 4590f6e33ba37652ce8422d578fc05ac048d3bfd
Author: Baoquan He <bhe at redhat.com>
Date:   Thu Dec 13 14:17:26 2012 +0800

    Optimize redundent code fetching server of network dump
    
    Code in function kdump_install_net used to get server of network dump
    is is a little redundent, can be optimized into one line. For nfs/ssh,
    this line of code is enough.
    
    Test passed on local kvm guest with Fedora 18.
    
    Signed-off-by: Baoquan He <bhe at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>

 dracut-module-setup.sh |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 9741c84..f354c80 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -165,11 +165,7 @@ kdump_install_net() {
     local _server _netdev
     local config_val="$1"
 
-    if strstr "$config_val" "@"; then
-        _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
-        else
-            _server=$(echo $config_val | sed -e 's#\(.*\):.*#\1#')
-        fi
+    _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
 
     _need_dns=`echo $_server|grep "[a-zA-Z]"`
     [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`


More information about the scm-commits mailing list