module-jack-tunnel: Properly propagate error from dlopen()

dlopen() does not set errno on failure, rather you're supposed to call
dlerror() to get the latest error. dlerror() return a string so
instead return -ENOENT from weakjack_load_by_path().

Depending on errno weakjack_load() could think it successfully loaded
the library, and later module-jack-tunnel would crash because it call
a NULL function pointer.
This commit is contained in:
Daniel Lundqvist 2024-07-17 20:26:56 +02:00 committed by Wim Taymans
parent b19c3501e7
commit 4902646e73

View file

@ -101,7 +101,7 @@ static inline int weakjack_load_by_path(struct weakjack *jack, const char *path)
hnd = dlopen(path, RTLD_NOW);
if (hnd == NULL)
return -errno;
return -ENOENT;
pw_log_info("opened libjack: %s", path);