Index: /i2c-tools/trunk/eeprom/decode-dimms
===================================================================
--- /i2c-tools/trunk/eeprom/decode-dimms	(revision 5690)
+++ /i2c-tools/trunk/eeprom/decode-dimms	(revision 5691)
@@ -1616,5 +1616,5 @@
 sub get_dimm_list
 {
-	my $dir;
+	my ($dir, $file, @files);
 
 	if ($use_sysfs) {
@@ -1624,6 +1624,11 @@
 	}
 
-	if (-d $dir) {
-		return split(/\s+/, `ls $dir`);
+	if (opendir(local *DIR, $dir)) {
+		while (defined($file = readdir(DIR))) {
+			next if $file =~ m/^\./;
+			push @files, $file;
+		}
+		close(DIR);
+		return sort @files;
 	} elsif (! -d '/sys/module/eeprom') {
 		print "No EEPROM found, are you sure the eeprom module is loaded?\n";
