From 3c1a92f965e5614c0ba7175068b46a91ac56dd3c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 11 Jun 2008 02:18:37 +0200 Subject: Make automatic backend discovery actually work --- src/dso.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dso.c b/src/dso.c index 0953be5..c4b9da6 100644 --- a/src/dso.c +++ b/src/dso.c @@ -24,6 +24,7 @@ #include #include +#include #include "driver.h" #include "common.h" @@ -126,14 +127,20 @@ static int try_open(ca_context *c, const char *t) { p = PRIVATE_DSO(c); - if (!(mn = ca_sprintf_malloc("libcanberra-%s", c->driver))) + if (!(mn = ca_sprintf_malloc("libcanberra-%s", t))) return CA_ERROR_OOM; + errno = 0; p->module = lt_dlopenext(mn); ca_free(mn); if (!p->module) { - int ret = ca_error_from_string(lt_dlerror()); + int ret; + + if (errno == ENOENT) + ret = CA_ERROR_NOTFOUND; + else + ret = ca_error_from_string(lt_dlerror()); if (ret == CA_ERROR_NOTFOUND) ret = CA_ERROR_NODRIVER; -- cgit