From 4902646e73df3664de1bcc08c1f58a92f0b909db Mon Sep 17 00:00:00 2001 From: Daniel Lundqvist Date: Wed, 17 Jul 2024 20:26:56 +0200 Subject: [PATCH] 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. --- src/modules/module-jack-tunnel/weakjack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module-jack-tunnel/weakjack.h b/src/modules/module-jack-tunnel/weakjack.h index e9ad7f4a7..1b057b0ba 100644 --- a/src/modules/module-jack-tunnel/weakjack.h +++ b/src/modules/module-jack-tunnel/weakjack.h @@ -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);