From ad5b392f912149b4211ac8726cbe04e645c33a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Terje=20R=C3=B8sten?= Date: Thu, 11 Aug 2016 20:38:51 +0200 Subject: [PATCH] Add patches to fix sysconf/long_bit issue and crash (bz#1342792) --- lshw-B.02.18-long-bit.patch | 13 +++++++++++++ lshw-B.02.18-scandir.patch | 26 ++++++++++++++++++++++++++ lshw.spec | 9 ++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 lshw-B.02.18-long-bit.patch create mode 100644 lshw-B.02.18-scandir.patch diff --git a/lshw-B.02.18-long-bit.patch b/lshw-B.02.18-long-bit.patch new file mode 100644 index 0000000..002743a --- /dev/null +++ b/lshw-B.02.18-long-bit.patch @@ -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); + diff --git a/lshw-B.02.18-scandir.patch b/lshw-B.02.18-scandir.patch new file mode 100644 index 0000000..27c64b7 --- /dev/null +++ b/lshw-B.02.18-scandir.patch @@ -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; id_name); +- free(namelist[i]); ++ if (n > 0) { ++ for(i=0; id_name); ++ free(namelist[i]); ++ } ++ if(namelist) ++ free(namelist); + } +- if(namelist) +- free(namelist); + } + + popd(); diff --git a/lshw.spec b/lshw.spec index 0607427..f857349 100644 --- a/lshw.spec +++ b/lshw.spec @@ -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 - B.02.18-4 +- Add patches to fix sysconf/long_bit issue and crash (bz#1342792) + * Wed May 18 2016 Terje Rosten - B.02.18-3 - Add patch to fix crash (bz#1332486)