This commit is contained in:
garnier-quentin 2014-03-27 21:00:19 +01:00
parent 0bf46bfceb
commit 454696e4a1
2 changed files with 26 additions and 4 deletions

View File

@ -89,10 +89,21 @@ sub manage_selection {
#|/dev/sda|SD280813AS|35|C|#|/dev/sdb|ST2000CD005-1CH134|35|C|
my $_ = <$oSocketConn>;
my $line;
eval {
local $SIG{ALRM} = sub { die "Timeout by signal ALARM\n"; };
alarm(10);
$line = <$oSocketConn>;
alarm(0);
};
$oSocketConn->shutdown(2);
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot get informations.");
$self->{output}->option_exit();
}
while (m/\|([^|]+)\|([^|]+)\|([^|]+)\|(C|F)\|/g) {
while ($line =~ /\|([^|]+)\|([^|]+)\|([^|]+)\|(C|F)\|/g) {
my ($drive, $serial, $temperature, $unit) = ($1, $2, $3, $4);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&

View File

@ -99,10 +99,21 @@ sub manage_selection {
#|/dev/sda|SD280813AS|35|C|#|/dev/sdb|ST2000CD005-1CH134|35|C|
my $_ = <$oSocketConn>;
my $line;
eval {
local $SIG{ALRM} = sub { die "Timeout by signal ALARM\n"; };
alarm(10);
$line = <$oSocketConn>;
alarm(0);
};
$oSocketConn->shutdown(2);
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot get informations.");
$self->{output}->option_exit();
}
while (m/\|([^|]+)\|([^|]+)\|([^|]+)\|(C|F)\|/g) {
while ($line =~ /\|([^|]+)\|([^|]+)\|([^|]+)\|(C|F)\|/g) {
my ($drive, $serial, $temperature, $unit) = ($1, $2, $3, $4);
next if (defined($self->{option_results}->{name}) && defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi})