Add patches to fix sysconf/long_bit issue and crash (bz#1342792)

This commit is contained in:
Terje Røsten 2016-08-11 20:38:51 +02:00
parent 1f3a87e120
commit ad5b392f91
3 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/core/abi.cc b/src/core/abi.cc
index 76e5082..76c664c 100644
--- a/src/core/abi.cc
+++ b/src/core/abi.cc
@@ -20,7 +20,7 @@ __ID("@(#) $Id: mem.cc 1352 2006-05-27 23:54:13Z ezix $");
bool scan_abi(hwNode & system)
{
// are we compiled as 32- or 64-bit process ?
- system.setWidth(sysconf(LONG_BIT));
+ system.setWidth(LONG_BIT);
pushd(PROC_SYS);

View File

@ -0,0 +1,26 @@
diff --git a/src/core/abi.cc b/src/core/abi.cc
index 76c664c..b5bd9c9 100644
--- a/src/core/abi.cc
+++ b/src/core/abi.cc
@@ -36,13 +36,15 @@ bool scan_abi(hwNode & system)
struct dirent **namelist;
n = scandir(".", &namelist, selectfile, alphasort);
- for(i=0; i<n; i++)
- {
- system.addCapability(namelist[i]->d_name);
- free(namelist[i]);
+ if (n > 0) {
+ for(i=0; i<n; i++)
+ {
+ system.addCapability(namelist[i]->d_name);
+ free(namelist[i]);
+ }
+ if(namelist)
+ free(namelist);
}
- if(namelist)
- free(namelist);
}
popd();

View File

@ -1,7 +1,7 @@
Summary: Hardware lister
Name: lshw
Version: B.02.18
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
Group: Applications/System
URL: http://ezix.org/project/wiki/HardwareLiSter
@ -10,6 +10,8 @@ Source1: lshw.desktop
Source2: org.ezix.lshw.gui.policy
Source3: lshw-gui
Patch1: lshw-B.02.18-non-root.patch
Patch2: lshw-B.02.18-long-bit.patch
Patch3: lshw-B.02.18-scandir.patch
Requires: hwdata
%description
lshw is a small tool to provide detailed informaton on the hardware
@ -35,6 +37,8 @@ format.
%prep
%setup -q
%patch01 -p1
%patch02 -p1
%patch03 -p1
%build
make %{?_smp_mflags} SBINDIR="%{_sbindir}" RPM_OPT_FLAGS="%{optflags}" gui
@ -103,6 +107,9 @@ rm -rf %{buildroot}%{_datadir}/locale/fr/
%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
%changelog
* Thu Aug 11 2016 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-4
- Add patches to fix sysconf/long_bit issue and crash (bz#1342792)
* Wed May 18 2016 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-3
- Add patch to fix crash (bz#1332486)