aboutsummaryrefslogtreecommitdiffstats
path: root/community/lshw/basename-limits-long-bits.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-07-04 16:08:19 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-07-04 16:09:49 +0200
commit1d23785857140fd8affd228a88587c19baec6dd6 (patch)
treec96bb2a9f0151989ff8f977defb56a55a3f47747 /community/lshw/basename-limits-long-bits.patch
parent9d226a44dae8a69af959ad29eea49795838f4026 (diff)
downloadaports-1d23785857140fd8affd228a88587c19baec6dd6.tar.bz2
aports-1d23785857140fd8affd228a88587c19baec6dd6.tar.xz
community/lshw: move from testing
Diffstat (limited to 'community/lshw/basename-limits-long-bits.patch')
-rw-r--r--community/lshw/basename-limits-long-bits.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/community/lshw/basename-limits-long-bits.patch b/community/lshw/basename-limits-long-bits.patch
new file mode 100644
index 0000000000..68c9cf983f
--- /dev/null
+++ b/community/lshw/basename-limits-long-bits.patch
@@ -0,0 +1,68 @@
+commit 9389deed8b49a4845c51d5e7177d143cbb96718a
+Author: Isaac Dunham <ibid.ag@gmail.com>
+Date: Fri Sep 12 21:45:32 2014 -0700
+
+ Numerous less obvious fixes
+
+ -sysconf(_SC_LONG_BIT) is 8*sizeof(long)
+ -POSIX basename() requires a char *, not const char*
+ -limits.h is necessary for PATH_MAX
+
+diff --git a/src/core/abi.cc b/src/core/abi.cc
+index 5fdd8e3..7f78d4b 100644
+--- a/src/core/abi.cc
++++ b/src/core/abi.cc
+@@ -19,7 +19,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(_SC_LONG_BIT));
++ system.setWidth(8*sizeof(long));
+
+ pushd(PROC_SYS);
+
+diff --git a/src/core/cpufreq.cc b/src/core/cpufreq.cc
+index da3960f..aa0df00 100644
+--- a/src/core/cpufreq.cc
++++ b/src/core/cpufreq.cc
+@@ -17,6 +17,7 @@
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <dirent.h>
++#include <limits.h>
+
+ __ID("@(#) $Id: cpufreq.cc 2470 2012-01-19 12:04:26Z lyonel $");
+
+diff --git a/src/core/pci.cc b/src/core/pci.cc
+index aaa257c..b8a7917 100644
+--- a/src/core/pci.cc
++++ b/src/core/pci.cc
+@@ -12,6 +12,8 @@
+ #include <string.h>
+ #include <stdlib.h>
+ #include <dirent.h>
++#include <libgen.h>
++#include <limits.h>
+
+ __ID("@(#) $Id: pci.cc 2496 2012-05-15 08:00:13Z lyonel $");
+
+@@ -1127,10 +1129,16 @@ bool scan_pci(hwNode & n)
+ {
+ string drivername = readlink(string(devices[i]->d_name)+"/driver");
+ string modulename = readlink(string(devices[i]->d_name)+"/driver/module");
+-
+- device->setConfig("driver", basename(drivername.c_str()));
++ char driver_c[PATH_MAX];
++ char module_c[PATH_MAX];
++ bzero(driver_c,PATH_MAX);
++ bzero(module_c,PATH_MAX);
++ strncpy(driver_c, drivername.c_str(),PATH_MAX);
++ strncpy(module_c, modulename.c_str(),PATH_MAX);
++
++ device->setConfig("driver", basename(driver_c));
+ if(exists(modulename))
+- device->setConfig("module", basename(modulename.c_str()));
++ device->setConfig("module", basename(module_c));
+
+ if(exists(string(devices[i]->d_name)+"/rom"))
+ {