[libvirt] [PATCH 3/4] libvirt-guest.init: declare variables as local

Philipp Hahn hahn at univention.de
Wed Mar 9 09:01:32 UTC 2011


Declare variables used in function only as local.

Signed-off-by: Philipp Hahn <hahn at univention.de>
---
 tools/libvirt-guests.init.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
index ab2b907..8da7576 100644
--- a/tools/libvirt-guests.init.sh
+++ b/tools/libvirt-guests.init.sh
@@ -62,6 +62,7 @@ retval() {
 }
 
 run_virsh() {
+    local uri
     uri=$1
     shift
 
@@ -77,6 +78,7 @@ run_virsh_c() {
 }
 
 list_guests() {
+    local uri list uuids id uuid
     uri=$1
 
     list=$(run_virsh_c "$uri" list)
@@ -99,6 +101,7 @@ list_guests() {
 }
 
 guest_name() {
+    local uri uuid name
     uri=$1
     uuid=$2
 
@@ -110,6 +113,7 @@ guest_name() {
 }
 
 guest_is_on() {
+    local uri uuid info id
     uri=$1
     uuid=$2
 
@@ -131,6 +135,7 @@ started() {
 }
 
 start() {
+    local configured confuri guest name
     [ -f "$LISTFILE" ] || { started; return 0; }
 
     if [ "x$ON_BOOT" != xstart ]; then
@@ -175,6 +180,7 @@ start() {
 
 suspend_guest()
 {
+    local uri guest name label virsh_pid
     uri=$1
     guest=$2
 
@@ -199,6 +205,7 @@ suspend_guest()
 
 shutdown_guest()
 {
+    local uri guest name label timeout
     uri=$1
     guest=$2
 
@@ -226,6 +233,7 @@ shutdown_guest()
 }
 
 stop() {
+    local suspending uri list guest
     # last stop was not followed by start
     [ -f "$LISTFILE" ] && return 0
 
@@ -286,6 +294,7 @@ stop() {
 }
 
 gueststatus() {
+    local uri
     for uri in $URIS; do
         echo "* $uri URI:"
         retval run_virsh "$uri" list || echo
@@ -313,6 +322,7 @@ rh_status() {
 # usage [val]
 # Display usage string, then exit with VAL (defaults to 2).
 usage() {
+    local program_name
     program_name=$0
     eval_gettext "Usage: \$program_name {start|stop|status|restart|"\
 "condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo
-- 
1.7.1





More information about the libvir-list mailing list