lshw: unbreak musl

This commit is contained in:
Jürgen Buchmüller 2016-05-07 05:40:35 +02:00
parent 3783da7560
commit 54900d99f5
3 changed files with 37 additions and 15 deletions

View File

@ -0,0 +1,13 @@
Fix GCC warning "array subscript is above array bounds [-Warray-bounds]"
--- src/core/dmi.cc 2016-05-06 22:17:33.416045355 +0200
+++ src/core/dmi.cc 2016-05-06 22:21:31.694032471 +0200
@@ -511,7 +511,7 @@
if (num <= 0x0A)
return _(memory_array_location[num]);
if (num >= 0xA0 && num < 0xA4)
- return _(jp_memory_array_location[num]);
+ return _(jp_memory_array_location[num - 0xA0]);
return "";
}

View File

@ -1,19 +1,28 @@
For musl libc declare a simple, local version of basename(3)
which expects a const char* parameter.
For musl libc declare a macro version of basename(3).
--- src/core/pci.cc 2015-10-14 10:00:49.449367706 +0200
+++ src/core/pci.cc 2015-10-14 10:02:18.567360753 +0200
@@ -12,6 +12,13 @@
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
--- src/core/dasd.cc 2016-05-07 05:33:49.580629923 +0200
+++ src/core/dasd.cc 2016-05-07 05:35:10.000625574 +0200
@@ -10,6 +10,10 @@
#include <linux/fs.h>
#include <map>
+#if !defined(__GLIBC__)
+static const char * basename(const char * src)
+{
+ char* slash = strrchr(src, '/');
+ return slash ? slash+1 : src;
+}
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
+#endif
+
using namespace std;
__ID("@(#) $Id: pci.cc 2496 2012-05-15 08:00:13Z lyonel $");
/*Read only block devices, not partitions*/
--- src/core/sysfs.cc 2016-05-07 05:36:45.771620396 +0200
+++ src/core/sysfs.cc 2016-05-07 05:37:33.265617827 +0200
@@ -19,6 +19,10 @@
__ID("@(#) $Id$");
+#if !defined(__GLIBC__)
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
+#endif
+
using namespace sysfs;
struct sysfs::entry_i

View File

@ -1,7 +1,7 @@
# Template build file for 'lshw'.
pkgname=lshw
version=B.02.18
revision=1
revision=2
makedepends="gtk+-devel libglade-devel sqlite-devel"
hostmakedepends="pkg-config"
short_desc="Hardware lister application"