From ca9d7cd70827279dbeab32accd4aaadece317c1b Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Fri, 25 Dec 2020 10:07:47 +0100 Subject: Also find libsensors.so.4 for Fedora and friends --- linux/LibSensors.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/linux/LibSensors.c b/linux/LibSensors.c index 5e119350..3df327c2 100644 --- a/linux/LibSensors.c +++ b/linux/LibSensors.c @@ -23,13 +23,15 @@ static void* dlopenHandle = NULL; int LibSensors_init(FILE* input) { if (!dlopenHandle) { + /* Find the unversioned libsensors.so (symlink) and prefer that, but Debian has .so.5 and Fedora .so.4 without + matching symlinks (unless people install the -dev packages) */ dlopenHandle = dlopen("libsensors.so", RTLD_LAZY); - if (!dlopenHandle) { - /* Debian contains no unversioned .so in libsensors5, only in the -dev package, so work around that: */ + if (!dlopenHandle) dlopenHandle = dlopen("libsensors.so.5", RTLD_LAZY); - if (!dlopenHandle) - goto dlfailure; - } + if (!dlopenHandle) + dlopenHandle = dlopen("libsensors.so.4", RTLD_LAZY); + if (!dlopenHandle) + goto dlfailure; /* Clear any errors */ dlerror(); -- cgit v1.2.3