Skip to content

Commit

Permalink
don't run dmidecode.exe on Win2003
Browse files Browse the repository at this point in the history
dmidecode.exe generates segfault on Win2003. We ensure we are on Win2003+
Windows before the execution.

see: #379
closes: #1746

Reported on the forum, please use the bug tracker Instead.
http://forum.fusioninventory.org/viewtopic.php?pid=8889
  • Loading branch information
Gonéri Le Bouder committed Aug 6, 2012
1 parent 58bf107 commit 9afeae5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,12 @@ use warnings;
use English qw(-no_match_vars);
use UNIVERSAL::require;

use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Generic;

sub isEnabled {

if ($OSNAME eq 'MSWin32') {
# don't run dmidecode on Win2003
# http://forge.fusioninventory.org/issues/379
Win32->require();
my @osver = Win32::GetOSVersion();
return if
$osver[4] == 2 &&
$osver[1] == 5 &&
$osver[2] == 2;
}

return unless canRun('dmidecode');

my $count = getLinesCount(
command => "dmidecode"
);
return $count > 10;
return unless getDmidecodeInfos();

}

sub doInventory {}
Expand Down
14 changes: 13 additions & 1 deletion lib/FusionInventory/Agent/Tools/Generic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ sub getDmidecodeInfos {
@_
);

my $handle = getFileHandle(%params);
if ($OSNAME eq 'MSWin32') {
# don't run dmidecode on Win2003
# http://forge.fusioninventory.org/issues/379
Win32->require();
my @osver = Win32::GetOSVersion();
return if
$osver[4] == 2 &&
$osver[1] == 5 &&
$osver[2] == 2;
}

my $handle = getFileHandle(%params);
my ($info, $block, $type);

while (my $line = <$handle>) {
Expand Down Expand Up @@ -59,6 +69,8 @@ sub getDmidecodeInfos {
}
close $handle;

return if 2 > keys %$info;

return $info;
}

Expand Down

0 comments on commit 9afeae5

Please sign in to comment.