]> the.earth.li Git - onak.git/commitdiff
Gracefully exit if no backend defined.
authorJonathan McDowell <noodles@earth.li>
Mon, 19 Jun 2006 21:01:55 +0000 (21:01 +0000)
committerJonathan McDowell <noodles@earth.li>
Mon, 19 Jun 2006 21:01:55 +0000 (21:01 +0000)
If no backend was defined we were attempting to strlen a NULL string,
which isn't sensible. Gracefully exit with a critical error instead.

keydb_dynamic.c

index ca489ae46b2b70a2a7b4febc172d57211ad0477a..f12889c24afc8d37fa3f36236eecfd878d65e626 100644 (file)
@@ -39,6 +39,11 @@ bool load_backend(void)
                close_backend();
        }
 
+       if (!config.db_backend) {
+               logthing(LOGTHING_CRITICAL, "No database backend defined.");
+               exit(EXIT_FAILURE);
+       }
+
        if (config.backends_dir == NULL) {
                soname = malloc(strlen(config.db_backend)
                        + strlen("/libkeydb_")