mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 12:15:32 +03:00
40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
commit 9389deed8b49a4845c51d5e7177d143cbb96718a
|
|
Author: Isaac Dunham <ibid.ag@gmail.com>
|
|
Date: Fri Sep 12 21:45:32 2014 -0700
|
|
|
|
Numerous less obvious fixes
|
|
|
|
-POSIX basename() requires a char *, not const char*
|
|
|
|
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
|
|
@@ -13,6 +13,7 @@
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <dirent.h>
|
|
+#include <limits.h>
|
|
|
|
__ID("@(#) $Id$");
|
|
|
|
@@ -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(const_cast<char *>(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(const_cast<char *>(modulename.c_str())));
|
|
+ device->setConfig("module", basename(module_c));
|
|
|
|
if(exists(string(devices[i]->d_name)+"/rom"))
|
|
{
|