diff options
author | Lennart Poettering <mzfuryy@0pointer.net> | 2008-06-11 02:18:37 +0200 |
---|---|---|
committer | Lennart Poettering <mzfuryy@0pointer.net> | 2008-06-11 02:18:37 +0200 |
commit | 3c1a92f965e5614c0ba7175068b46a91ac56dd3c (patch) | |
tree | e9c1a9b6917f0ae120c080e7c0d44fbf2e34b252 | |
parent | 4e6323606727ba6e416d4a16456ac98efd598309 (diff) |
Make automatic backend discovery actually work
-rw-r--r-- | src/dso.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -24,6 +24,7 @@ #include <ltdl.h> #include <string.h> +#include <errno.h> #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; |