Also find libsensors.so.4 for Fedora and friends

This commit is contained in:
Daniel Lange 2020-12-25 10:07:47 +01:00 committed by BenBE
parent debeac49cd
commit ca9d7cd708
1 changed files with 7 additions and 5 deletions

View File

@ -23,13 +23,15 @@ static void* dlopenHandle = NULL;
int LibSensors_init(FILE* input) { int LibSensors_init(FILE* input) {
if (!dlopenHandle) { 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); dlopenHandle = dlopen("libsensors.so", RTLD_LAZY);
if (!dlopenHandle) { if (!dlopenHandle)
/* Debian contains no unversioned .so in libsensors5, only in the -dev package, so work around that: */
dlopenHandle = dlopen("libsensors.so.5", RTLD_LAZY); dlopenHandle = dlopen("libsensors.so.5", RTLD_LAZY);
if (!dlopenHandle)
dlopenHandle = dlopen("libsensors.so.4", RTLD_LAZY);
if (!dlopenHandle) if (!dlopenHandle)
goto dlfailure; goto dlfailure;
}
/* Clear any errors */ /* Clear any errors */
dlerror(); dlerror();