From 6ff8a21179e62805fa631c899e38e8fdda6e7b5a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 1 Sep 2006 21:34:56 +0000 Subject: [PATCH] Properly handle the case where the eeprom driver is not loaded. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4132 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/eeprom/decode-dimms.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/prog/eeprom/decode-dimms.pl b/prog/eeprom/decode-dimms.pl index 3eb13d95..8e68621a 100755 --- a/prog/eeprom/decode-dimms.pl +++ b/prog/eeprom/decode-dimms.pl @@ -1077,9 +1077,16 @@ Version 2.10.1'; my $dimm_count=0; -if ($use_sysfs) { $_=`ls /sys/bus/i2c/drivers/eeprom`; } -else { $_=`ls /proc/sys/dev/sensors/`; } -my @dimm_list=split(); +my @dimm_list; +my $dir; +if ($use_sysfs) { $dir = '/sys/bus/i2c/drivers/eeprom'; } +else { $dir = '/proc/sys/dev/sensors'; } +if (-d $dir) { + @dimm_list = split(/\s+/, `ls $dir`); +} elsif (! -d '/sys/module/eeprom') { + print "No EEPROM found, are you sure the eeprom module is loaded?\n"; + exit; +} for my $i ( 0 .. $#dimm_list ) { $_=$dimm_list[$i];