Show
Ignore:
Timestamp:
03/20/09 15:08:43 (6 years ago)
Author:
khali
Message:

Don't call an external tool (ls) to get the list of dimms. Using
opendir() is more efficient and more flexible.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/eeprom/decode-dimms

    r5690 r5691  
    16161616sub get_dimm_list 
    16171617{ 
    1618         my $dir; 
     1618        my ($dir, $file, @files); 
    16191619 
    16201620        if ($use_sysfs) { 
     
    16241624        } 
    16251625 
    1626         if (-d $dir) { 
    1627                 return split(/\s+/, `ls $dir`); 
     1626        if (opendir(local *DIR, $dir)) { 
     1627                while (defined($file = readdir(DIR))) { 
     1628                        next if $file =~ m/^\./; 
     1629                        push @files, $file; 
     1630                } 
     1631                close(DIR); 
     1632                return sort @files; 
    16281633        } elsif (! -d '/sys/module/eeprom') { 
    16291634                print "No EEPROM found, are you sure the eeprom module is loaded?\n";