From: rjk@greenend.org.uk <> Date: Sat, 5 Jan 2008 15:14:26 +0000 (+0000) Subject: Fix dlerror() abuse. X-Git-Tag: 5.0.3~231 X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/commitdiff_plain/f47f36374646082cff0dd8258b39d986f7f21bc5?ds=sidebyside Fix dlerror() abuse. All tests now pass on my FreeBSD 6.2 VM. --- diff --git a/lib/plugin.c b/lib/plugin.c index 1c526de..abeaa66 100644 --- a/lib/plugin.c +++ b/lib/plugin.c @@ -84,22 +84,22 @@ const struct plugin *open_plugin(const char *name, function_t *get_plugin_function(const struct plugin *pl, const char *symbol) { function_t *f; - const char *e; f = (function_t *)dlsym(pl->dlhandle, symbol); - if((e = dlerror())) - fatal(0, "error looking up function '%s' in '%s': %s",symbol, pl->name, e); + if(!f) + fatal(0, "error looking up function '%s' in '%s': %s", + symbol, pl->name, dlerror()); return f; } const void *get_plugin_object(const struct plugin *pl, const char *symbol) { void *o; - const char *e; o = dlsym(pl->dlhandle, symbol); - if((e = dlerror())) - fatal(0, "error looking up object '%s' in '%s': %s", symbol, pl->name, e); + if(!o) + fatal(0, "error looking up object '%s' in '%s': %s", + symbol, pl->name, dlerror()); return o; }