- ssnprintf(errbuf, sizeof(errbuf),
- "dlopen (\"%s\") failed: %s. "
- "The most common cause for this problem is "
- "missing dependencies. Use ldd(1) to check "
- "the dependencies of the plugin "
- "/ shared object.",
- file, dlerror());
-
- ERROR("%s", errbuf);
- /* Make sure this is printed to STDERR in any case, but also
- * make sure it's printed only once. */
- if (list_log != NULL)
- fprintf(stderr, "ERROR: %s\n", errbuf);
+ snprintf(errbuf, sizeof(errbuf),
+ "dlopen(\"%s\") failed: %s. "
+ "The most common cause for this problem is missing dependencies. "
+ "Use ldd(1) to check the dependencies of the plugin / shared "
+ "object.",
+ file, dlerror());
+
+ /* This error is printed to STDERR unconditionally. If list_log is NULL,
+ * plugin_log() will also print to STDERR. We avoid duplicate output by
+ * checking that the list of log handlers, list_log, is not NULL. */
+ fprintf(stderr, "ERROR: %s\n", errbuf);
+ if (list_log != NULL) {
+ ERROR("%s", errbuf);
+ }