summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-01-08 18:25:29 +0100
committerJo-Philipp Wich <jo@mein.io>2021-01-08 18:34:17 +0100
commitbc121a5a456b564618423b67a6aef859c0ba6a87 (patch)
tree010b0d51e4dc4426b81026442b434d8b47c64659
parent3d783bac13ba0c2406e0c00ca84eab7d4e49c4a7 (diff)
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>
-rw-r--r--libs/rpcd-mod-luci/src/luci.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c
index 94ccdf2716..a16418d49d 100644
--- a/libs/rpcd-mod-luci/src/luci.c
+++ b/libs/rpcd-mod-luci/src/luci.c
@@ -802,11 +802,19 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
struct iwinfo_crypto_entry crypto = {};
struct iwinfo_hardware_id ids = {};
const struct iwinfo_ops *iw;
- void *iwlib, *o, *o2, *a;
- int nret;
+ void *iwlib = NULL;
+ void *o, *o2, *a;
+ glob_t paths;
+ int nret, i;
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)
return false;