diff -Naur lm_sensors-3.3.3.orig/prog/detect/sensors-detect lm_sensors-3.3.3/prog/detect/sensors-detect --- lm_sensors-3.3.3.orig/prog/detect/sensors-detect 2012-10-30 18:18:45.000000000 +0100 +++ lm_sensors-3.3.3/prog/detect/sensors-detect 2013-01-17 15:04:46.354612233 +0100 @@ -2463,9 +2463,12 @@ sub initialize_ioports { - sysopen(IOPORTS, "/dev/port", O_RDWR) - or die "/dev/port: $!\n"; - binmode(IOPORTS); + if (sysopen(IOPORTS, "/dev/port", O_RDWR)) { + binmode(IOPORTS); + return 1; + } + print STDERR "/dev/port: $!\n"; + return 0; } sub close_ioports @@ -3493,13 +3496,14 @@ print("Can't set I2C address for $dev\n"), next; - initialize_ioports(); - $alias_detect = $detected->[$isa]->{alias_detect}; - $is_alias = &$alias_detect($detected->[$isa]->{isa_addr}, - \*FILE, - $detected->[$i2c]->{i2c_addr}); + if (initialize_ioports()) { + $alias_detect = $detected->[$isa]->{alias_detect}; + $is_alias = &$alias_detect($detected->[$isa]->{isa_addr}, + \*FILE, + $detected->[$i2c]->{i2c_addr}); + close_ioports(); + } close(FILE); - close_ioports(); next unless $is_alias; # This is an alias: copy the I2C data into the ISA @@ -6814,10 +6818,11 @@ "standard I/O ports to probe them. This is usually safe.\n"; print "Do you want to scan for Super I/O sensors? (YES/no): "; unless ( =~ /^\s*n/i) { - initialize_ioports(); - $superio_features |= scan_superio(0x2e, 0x2f); - $superio_features |= scan_superio(0x4e, 0x4f); - close_ioports(); + if (initialize_ioports()) { + $superio_features |= scan_superio(0x2e, 0x2f); + $superio_features |= scan_superio(0x4e, 0x4f); + close_ioports(); + } } print "\n"; @@ -6830,9 +6835,10 @@ "interfaces? (YES/no): "; unless ( =~ /^\s*n/i) { if (!ipmi_from_smbios()) { - initialize_ioports(); - scan_isa_bus(\@ipmi_ifs); - close_ioports(); + if (initialize_ioports()) { + scan_isa_bus(\@ipmi_ifs); + close_ioports(); + } } } print "\n"; @@ -6846,9 +6852,10 @@ $input = ; unless ($input =~ /^\s*n/i || ($superio_features && $input !~ /^\s*y/i)) { - initialize_ioports(); - scan_isa_bus(\@chip_ids); - close_ioports(); + if (initialize_ioports()) { + scan_isa_bus(\@chip_ids); + close_ioports(); + } } print "\n"; }