rpcd-mod-luci: allow finding suffixed libwinfo.so
Recent versions ship a version suffixed libiwinfo.so, therefor we cannot rely on a fixed path name anymore. Use globbing to find matching libraries and load the first one we find. Fixes: #4718 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
3d783bac13
commit
bc121a5a45
1 changed files with 11 additions and 3 deletions
|
@ -802,11 +802,19 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
|
||||||
struct iwinfo_crypto_entry crypto = {};
|
struct iwinfo_crypto_entry crypto = {};
|
||||||
struct iwinfo_hardware_id ids = {};
|
struct iwinfo_hardware_id ids = {};
|
||||||
const struct iwinfo_ops *iw;
|
const struct iwinfo_ops *iw;
|
||||||
void *iwlib, *o, *o2, *a;
|
void *iwlib = NULL;
|
||||||
int nret;
|
void *o, *o2, *a;
|
||||||
|
glob_t paths;
|
||||||
|
int nret, i;
|
||||||
|
|
||||||
if (!iw_backend || !iw_close || !iw_modenames) {
|
if (!iw_backend || !iw_close || !iw_modenames) {
|
||||||
iwlib = dlopen("libiwinfo.so", RTLD_LAZY | RTLD_LOCAL);
|
if (glob("/usr/lib/libiwinfo.so*", 0, NULL, &paths) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (i = 0; i < paths.gl_pathc && !iwlib; i++)
|
||||||
|
iwlib = dlopen(paths.gl_pathv[i], RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
|
||||||
|
globfree(&paths);
|
||||||
|
|
||||||
if (!iwlib)
|
if (!iwlib)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue