From: janw Date: Tue, 8 Apr 2008 06:20:14 +0000 (+0000) Subject: Add additional checks if cfg is empty. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=63eda773b1621b72eabc412e15b2e9b90faa0dfc;p=gosa.git Add additional checks if cfg is empty. Correct SigInt-Handler (killall gosa-si-client) with a command that is safe and runnable on more operating systems. Closes #377 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10260 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index a56292bcd..c8116dc93 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -162,7 +162,7 @@ sub read_configfile { foreach my $section (keys %cfg_defaults) { foreach my $param (keys %{$cfg_defaults{ $section }}) { my $pinfo = $cfg_defaults{ $section }{ $param }; - ${@$pinfo[ 0 ]} = $cfg->val( $section, $param, @$pinfo[ 1 ] ); + ${@$pinfo[ 0 ]} = (defined($cfg))?$cfg->val( $section, $param, @$pinfo[ 1 ] ):${@$pinfo[ 0 ]} = @$pinfo[ 1 ]; } } } @@ -221,7 +221,7 @@ sub sig_int_handler { my ($signal) = @_; daemon_log("shutting down gosa-si-client", 1); - system("killall gosa-si-client"); + system("kill `ps -C gosa-si-client -o pid=`"); } $SIG{INT} = \&sig_int_handler; @@ -1268,7 +1268,7 @@ $default_server_key = $server_key; # add gosa-si-server address from config file at first position of server list my $server_check_cfg = Config::IniFiles->new( -file => $cfg_file ); -my $server_check = $server_check_cfg->val( "server", "ip"); +my $server_check = (defined($server_check_cfg))?$server_check_cfg->val( "server", "ip"):undef; if( defined $server_check ) { unshift(@servers, $server_address); my $servers_string = join(", ", @servers);