Fixing sensors-detect to avoid failures when the /dev/port is missing (#843521)
This commit is contained in:
parent
c7f2253af2
commit
4c1dde2abe
@ -1,15 +1,20 @@
|
|||||||
Name: lm_sensors
|
Name: lm_sensors
|
||||||
Version: 3.3.3
|
Version: 3.3.3
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
|
Summary: Hardware monitoring tools
|
||||||
|
Group: Applications/System
|
||||||
|
License: LGPLv2+
|
||||||
|
|
||||||
URL: http://www.lm-sensors.org/
|
URL: http://www.lm-sensors.org/
|
||||||
|
|
||||||
Source: http://dl.lm-sensors.org/lm-sensors/releases/%{name}-%{version}.tar.bz2
|
Source: http://dl.lm-sensors.org/lm-sensors/releases/%{name}-%{version}.tar.bz2
|
||||||
Source1: lm_sensors.sysconfig
|
Source1: lm_sensors.sysconfig
|
||||||
# these 2 were taken from PLD-linux, Thanks!
|
# these 2 were taken from PLD-linux, Thanks!
|
||||||
Source2: sensord.sysconfig
|
Source2: sensord.sysconfig
|
||||||
Source3: sensord.systemd
|
Source3: sensord.systemd
|
||||||
Summary: Hardware monitoring tools
|
|
||||||
Group: Applications/System
|
Patch0: sensors-detect-no-dev-port.patch
|
||||||
License: LGPLv2+
|
|
||||||
%ifarch %{ix86} x86_64
|
%ifarch %{ix86} x86_64
|
||||||
Requires: /usr/sbin/dmidecode
|
Requires: /usr/sbin/dmidecode
|
||||||
%endif
|
%endif
|
||||||
@ -56,6 +61,8 @@ database, and warns of sensor alarms.
|
|||||||
mv prog/init/README prog/init/README.initscripts
|
mv prog/init/README prog/init/README.initscripts
|
||||||
chmod -x prog/init/fancontrol.init
|
chmod -x prog/init/fancontrol.init
|
||||||
|
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="%{optflags}"
|
export CFLAGS="%{optflags}"
|
||||||
@ -120,7 +127,6 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%doc CHANGES CONTRIBUTORS COPYING doc README*
|
%doc CHANGES CONTRIBUTORS COPYING doc README*
|
||||||
%doc prog/init/fancontrol.init prog/init/README.initscripts
|
%doc prog/init/fancontrol.init prog/init/README.initscripts
|
||||||
%config(noreplace) %{_sysconfdir}/sensors3.conf
|
%config(noreplace) %{_sysconfdir}/sensors3.conf
|
||||||
@ -135,17 +141,14 @@ fi
|
|||||||
%exclude %{_mandir}/man8/sensord.8.gz
|
%exclude %{_mandir}/man8/sensord.8.gz
|
||||||
|
|
||||||
%files libs
|
%files libs
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{_libdir}/*.so.*
|
%{_libdir}/*.so.*
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{_includedir}/sensors
|
%{_includedir}/sensors
|
||||||
%{_libdir}/lib*.so
|
%{_libdir}/lib*.so
|
||||||
%{_mandir}/man3/*
|
%{_mandir}/man3/*
|
||||||
|
|
||||||
%files sensord
|
%files sensord
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%doc prog/sensord/README
|
%doc prog/sensord/README
|
||||||
%{_sbindir}/sensord
|
%{_sbindir}/sensord
|
||||||
%{_mandir}/man8/sensord.8.gz
|
%{_mandir}/man8/sensord.8.gz
|
||||||
@ -154,6 +157,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jan 17 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.3-2
|
||||||
|
- Fixing sensors-detect to avoid failures when the /dev/port is missing (#843521)
|
||||||
|
|
||||||
* Thu Dec 06 2012 Jaromir Capik <jcapik@redhat.com> - 3.3.3-1
|
* Thu Dec 06 2012 Jaromir Capik <jcapik@redhat.com> - 3.3.3-1
|
||||||
- Update to 3.3.3
|
- Update to 3.3.3
|
||||||
|
|
||||||
|
84
sensors-detect-no-dev-port.patch
Normal file
84
sensors-detect-no-dev-port.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
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 (<STDIN> =~ /^\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 (<STDIN> =~ /^\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 = <STDIN>;
|
||||||
|
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";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user