Howdy folks,

The following code snippet is part of plugin loading (from the 0.82
tarball, src/syncengine.c around line 1720).

            plugin = g_malloc0(sizeof(sync_plugin));
            g_assert(plugin);
            plugin->plugin = mod;
            plugin->shortname = CALL_PLUGIN(plugin, "short_name", ());
            ptr=dlerror();
            if (ptr != 0) {
              printf("ERROR: Failed to load plugin: %s! (Error=%s,
missing short
_name-symbol)\n", name, ptr);
              dlclose(mod);
              continue;
            }

CALL_PLUGIN is a macro using dlsym().

>From what I understand it is incorrect to test for an error using
dlerror(). This is because the error reported by dlerror() is not
cleared across successful calls to dlsym(), dlopen() etc.

In my case, libX11.so.6 was attempting to load nss_dns.so.1, which
failed noncritically - and the error was being caught by dlerror() in
multisync! So multisync thought the plugin failed to load, even though
the failure had nothing to do with multisync.

The code should probably be changed to check the return value of dlsym()
and interrogate dlerror() if and only if dlsym() has returned null.

However, if you want a quick fix, put a call to dlerror() before
CALL_PLUGIN. This will reset the error condition, guaranteeing that any
errors reported after CALL_PLUGIN actually belong to this operation.

Regards
Sam.



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Multisync-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/multisync-devel

Reply via email to