From 62d388406aab4acedf78c58b83827228a6ff41c5 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 2 Mar 2011 06:36:24 +0000 Subject: [PATCH] fix for bug 3196468: initialize global variables git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8959 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 48 ++++++++++++++------ 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 6eb72e472..7b6b7004e 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -133,6 +133,7 @@ sub process_request my $ret; my $msg; + &initialize_variables(); # globals used by all subroutines. $::command = $::request->{command}->[0]; $::args = $::request->{arg}; @@ -262,19 +263,7 @@ sub processArgs # Initialize some global arrays in case this is being called twice in the same process. # Currently only doing this when --nocache is specified, but i think it should be done all of the time. if ($::opt_c) { - %::CLIATTRS = (); - %::FILEATTRS = (); - %::FINALATTRS = (); - %::objfilehash = (); - %::WhereHash = (); - @::AttrList = (); - @::clobjtypes = (); - @::fileobjtypes = (); - @::clobjnames = (); - @::fileobjnames = (); - @::objfilelist = (); - @::allobjnames = (); - @::noderange = (); + &initialize_variables(); } # opt_x not yet supported @@ -3438,5 +3427,38 @@ sub defrm_usage return 0; } +#---------------------------------------------------------------------------- + +=head3 initialize_variables + Initialize the global variables + + Arguments: + Returns: + Globals: + + Error: + + Example: + + Comments: +=cut + +#----------------------------------------------------------------------------- +sub initialize_variables +{ + %::CLIATTRS = (); + %::FILEATTRS = (); + %::FINALATTRS = (); + %::objfilehash = (); + %::WhereHash = (); + @::AttrList = (); + @::clobjtypes = (); + @::fileobjtypes = (); + @::clobjnames = (); + @::fileobjnames = (); + @::objfilelist = (); + @::allobjnames = (); + @::noderange = (); +} 1;