]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird.c
Turn off debug
[bacula/bacula] / bacula / src / dird / dird.c
index 733b8dcfc1cf0d83707712f4d5ee8825d821c491..9cdab0fb86320ba800712c806228b2cf89f74837 100644 (file)
@@ -69,6 +69,7 @@ DIRRES *director;                     /* Director resource */
 int FDConnectTimeout;
 int SDConnectTimeout;
 char *configfile = NULL;
+void *start_heap;
 
 /* Globals Imported */
 extern int r_first, r_last;           /* first and last resources */
@@ -127,6 +128,7 @@ int main (int argc, char *argv[])
    char *uid = NULL;
    char *gid = NULL;
 
+   start_heap = sbrk(0);
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
@@ -226,6 +228,12 @@ int main (int argc, char *argv[])
       Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
    }
 
+   drop(uid, gid);                    /* reduce privileges if requested */
+
+   if (!check_catalog()) {
+      Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
+   }
+
    if (test_config) {
       terminate_dird(0);
    }
@@ -248,11 +256,6 @@ int main (int argc, char *argv[])
    create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
    read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
 
-   drop(uid, gid);                    /* reduce privileges if requested */
-
-   if (!check_catalog()) {
-      Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
-   }
 
 #if !defined(HAVE_WIN32)
    signal(SIGHUP, reload_config);
@@ -724,7 +727,7 @@ static bool check_resources()
       for (i=0; job_items[i].name; i++) {
          if (job_items[i].flags & ITEM_REQUIRED) {
                if (!bit_is_set(i, job->hdr.item_present)) {
-                  Jmsg(NULL, M_FATAL, 0, _("\"%s\" directive in Job \"%s\" resource is required, but not found.\n"),
+                  Jmsg(NULL, M_ERROR_TERM, 0, _("\"%s\" directive in Job \"%s\" resource is required, but not found.\n"),
                     job_items[i].name, job->name());
                   OK = false;
                 }
@@ -858,10 +861,14 @@ static bool check_catalog()
                          catalog->db_port, catalog->db_socket,
                          catalog->mult_db_connections);
       if (!db || !db_open_database(NULL, db)) {
+         Pmsg2(000, _("Could not open Catalog \"%s\", database \"%s\".\n"),
+              catalog->name(), catalog->db_name);
          Jmsg(NULL, M_FATAL, 0, _("Could not open Catalog \"%s\", database \"%s\".\n"),
               catalog->name(), catalog->db_name);
          if (db) {
             Jmsg(NULL, M_FATAL, 0, _("%s"), db_strerror(db));
+            Pmsg1(000, "%s", db_strerror(db));
+            db_close_database(NULL, db);
          }
          OK = false;
          continue;
@@ -959,5 +966,7 @@ static bool check_catalog()
       }
       db_close_database(NULL, db);
    }
+   /* Set type in global for debugging */
+   set_db_type(db_get_type());
    return OK;
 }