]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/message.c
Eliminate dependency on man2html.
[bacula/bacula] / bacula / src / lib / message.c
index ca15715c638800ba6f4d30021890e7ba670d68c4..6e131e55edb1d1777096c114c5d1ffa8928c80bd 100755 (executable)
@@ -47,16 +47,7 @@ char con_fname[500];                  /* Console filename */
 FILE *con_fd = NULL;                  /* Console file descriptor */
 brwlock_t con_lock;                   /* Console lock structure */
 
-
-#if defined(HAVE_POSTGRESQL)
-char catalog_db[] = "PostgreSQL";
-#elif defined(HAVE_MYSQL)
-char catalog_db[] = "MySQL";
-#elif defined(HAVE_SQLITE)
-char catalog_db[] = "SQLite";
-#else
-char catalog_db[] = "Internal";
-#endif
+static char *catalog_db = NULL;              /* database type */
 
 const char *host_os = HOST_OS;
 const char *distname = DISTNAME;
@@ -142,6 +133,23 @@ void my_name_is(int argc, char *argv[], const char *name)
    }
 }
 
+const char *
+get_db_type(void)
+{
+   return catalog_db != NULL ? catalog_db : "unknown";
+}
+
+void
+set_db_type(const char *name)
+{
+   if (catalog_db != NULL)
+   {
+      free(catalog_db);
+   }
+
+   catalog_db = bstrdup(name);
+}
+
 /*
  * Initialize message handler for a daemon or a Job
  *   We make a copy of the MSGS resource passed, so it belows
@@ -1289,12 +1297,17 @@ void dequeue_messages(JCR *jcr)
 {
    MQUEUE_ITEM *item;
    P(msg_queue_mutex);
+   if (!jcr->msg_queue) {
+      goto bail_out;
+   }
    jcr->dequeuing = true;
    foreach_dlist(item, jcr->msg_queue) {
       Jmsg(jcr, item->type, item->mtime, "%s", item->msg);
    }
    jcr->msg_queue->destroy();
    jcr->dequeuing = false;
+
+bail_out:
    V(msg_queue_mutex);
 }