Changeset 4467

Show
Ignore:
Timestamp:
06/25/07 19:08:15 (7 years ago)
Author:
khali
Message:

Fix the case where the system has different CPU models.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r4434 r4467  
    22452245  open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!"; 
    22462246  local $_; 
    2247   my %entry; 
     2247  my $entry; 
     2248 
    22482249  while (<INPUTFILE>) { 
    22492250    if (m/^processor\s*:\s*(\d+)/) { 
    2250       push @cpu, \%entry if scalar keys(%entry); # Previous entry 
    2251       %entry = (); # New entry 
     2251      push @cpu, $entry if scalar keys(%{$entry}); # Previous entry 
     2252      $entry = {}; # New entry 
    22522253      next; 
    22532254    } 
     
    22572258      $v =~ s/\s+/ /g;  # Merge multiple spaces 
    22582259      $v =~ s/ $//;     # Trim trailing space 
    2259       $entry{$k} = $v; 
     2260      $entry->{$k} = $v; 
    22602261      next; 
    22612262    } 
    22622263  } 
    2263   push @cpu, \%entry if scalar keys(%entry); # Last entry 
     2264  push @cpu, $entry if scalar keys(%{$entry}); # Last entry 
    22642265  close INPUTFILE; 
    22652266}