Code

plugin: Log to stderr if no logger has been registered.
authorSebastian Harl <sh@tokkee.org>
Sun, 20 Apr 2014 12:10:03 +0000 (14:10 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 20 Apr 2014 12:10:03 +0000 (14:10 +0200)
Check the length of the list rather than replying on it being uninitialized.

src/core/plugin.c

index 7584aa54d273bf0fce16ad7dd81f593a4e3ac7f0..188c7db1515859739efff2c456bd00c62f893f98 100644 (file)
@@ -959,7 +959,7 @@ sdb_plugin_log(int prio, const char *msg)
        if (! msg)
                return 0;
 
-       if (! log_list)
+       if (! sdb_llist_len(log_list))
                return fprintf(stderr, "[%s] %s\n", SDB_LOG_PRIO_TO_STRING(prio), msg);
 
        iter = sdb_llist_get_iter(log_list);