|
@@ -0,0 +1,78 @@
|
|
|
+From 016bdb133a44bdf42c268ff72ee7aa04af19cfd3 Mon Sep 17 00:00:00 2001
|
|
|
+From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
|
|
|
+Date: Sat, 27 Aug 2016 01:11:56 +0200
|
|
|
+Subject: [PATCH] Fix musl build: basename() is in libgen.h.
|
|
|
+
|
|
|
+Also, its argument is not const, so add const_cast. This is risky
|
|
|
+because in fact basename() will modify the argument if it ends with /
|
|
|
+but that's not the case here.
|
|
|
+
|
|
|
+Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
|
|
+---
|
|
|
+ src/core/dasd.cc | 1 +
|
|
|
+ src/core/sysfs.cc | 9 +++++----
|
|
|
+ 2 files changed, 6 insertions(+), 4 deletions(-)
|
|
|
+
|
|
|
+diff --git a/src/core/dasd.cc b/src/core/dasd.cc
|
|
|
+index 626b8a8..6276101 100644
|
|
|
+--- a/src/core/dasd.cc
|
|
|
++++ b/src/core/dasd.cc
|
|
|
+@@ -9,6 +9,7 @@
|
|
|
+ #include <sys/ioctl.h>
|
|
|
+ #include <linux/fs.h>
|
|
|
+ #include <map>
|
|
|
++#include <libgen.h>
|
|
|
+
|
|
|
+ using namespace std;
|
|
|
+
|
|
|
+diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
|
|
|
+index acc9d00..bdd69e3 100644
|
|
|
+--- a/src/core/sysfs.cc
|
|
|
++++ b/src/core/sysfs.cc
|
|
|
+@@ -16,6 +16,7 @@
|
|
|
+ #include <sys/stat.h>
|
|
|
+ #include <sys/types.h>
|
|
|
+ #include <sys/mount.h>
|
|
|
++#include <libgen.h>
|
|
|
+
|
|
|
+ __ID("@(#) $Id$");
|
|
|
+
|
|
|
+@@ -99,7 +100,7 @@ static string sysfs_getbustype(const string & path)
|
|
|
+ {
|
|
|
+ devname =
|
|
|
+ string(fs.path + "/bus/") + string(namelist[i]->d_name) +
|
|
|
+- "/devices/" + basename(path.c_str());
|
|
|
++ "/devices/" + basename(const_cast<char*>(path.c_str()));
|
|
|
+
|
|
|
+ if (samefile(devname, path))
|
|
|
+ return string(namelist[i]->d_name);
|
|
|
+@@ -139,7 +140,7 @@ static string sysfstobusinfo(const string & path)
|
|
|
+
|
|
|
+ if (bustype == "virtio")
|
|
|
+ {
|
|
|
+- string name = basename(path.c_str());
|
|
|
++ string name = basename(const_cast<char*>(path.c_str()));
|
|
|
+ if (name.compare(0, 6, "virtio") == 0)
|
|
|
+ return "virtio@" + name.substr(6);
|
|
|
+ else
|
|
|
+@@ -207,7 +208,7 @@ string entry::driver() const
|
|
|
+ string driverlink = This->devpath + "/driver";
|
|
|
+ if (!exists(driverlink))
|
|
|
+ return "";
|
|
|
+- return basename(readlink(driverlink).c_str());
|
|
|
++ return basename(const_cast<char*>(readlink(driverlink).c_str()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+@@ -288,7 +289,7 @@ string entry::name_in_class(const string & classname) const
|
|
|
+
|
|
|
+ string entry::name() const
|
|
|
+ {
|
|
|
+- return basename(This->devpath.c_str());
|
|
|
++ return basename(const_cast<char*>(This->devpath.c_str()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+--
|
|
|
+2.9.3
|
|
|
+
|