Refs #5389: Fix Errorhandeling

This commit is contained in:
Florian Asche 2014-03-27 00:08:50 +01:00
parent 8c0b6450e3
commit 0775b0707c
2 changed files with 13 additions and 3 deletions

View File

@ -53,7 +53,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '7634' },
"timeout:s" => { name => 'timeout', default => '1' },
"timeout:s" => { name => 'timeout', default => '10' },
"filter-name:s" => { name => 'filter_name', },
});
@ -80,7 +80,12 @@ sub manage_selection {
PeerAddr => $self->{option_results}->{hostname},
PeerPort => $self->{option_results}->{port},
Timeout => $self->{option_results}->{timeout},
) || $self->{output}->add_option_msg(short_msg => "Could not connect.") ; $self->{output}->option_exit();
);
if (!defined($oSocketConn)) {
$self->{output}->add_option_msg(short_msg => "Could not connect.");
$self->{output}->option_exit();
}
#|/dev/sda|SD280813AS|35|C|#|/dev/sdb|ST2000CD005-1CH134|35|C|

View File

@ -90,7 +90,12 @@ sub manage_selection {
PeerAddr => $self->{option_results}->{hostname},
PeerPort => $self->{option_results}->{port},
Timeout => $self->{option_results}->{timeout},
) || $self->{output}->add_option_msg(short_msg => "Could not connect.") ; $self->{output}->option_exit();
);
if (!defined($oSocketConn)) {
$self->{output}->add_option_msg(short_msg => "Could not connect.");
$self->{output}->option_exit();
}
#|/dev/sda|SD280813AS|35|C|#|/dev/sdb|ST2000CD005-1CH134|35|C|