]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix -c option in dbcheck
authorKern Sibbald <kern@sibbald.com>
Fri, 16 Jul 2004 22:14:28 +0000 (22:14 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 16 Jul 2004 22:14:28 +0000 (22:14 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1474 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/tools/dbcheck.c

index bfbb3a56fe3d42b4d5fad4c97d34f08a5272832f..c4af96203fe07a1fac33c4be0b6d548695b980e3 100644 (file)
@@ -168,12 +168,24 @@ int main (int argc, char *argv[])
         } else {
             Pmsg1(0, "Error there is no Catalog section in the given config file [%s]\n", configfile);
         }
-        return 1;
+        exit(1);
       } else {
-         db_name = catalog->db_name;
-         user = catalog->db_user;
-         password = catalog->db_password;
-          dbhost = (catalog->db_address[0] == '\0') ? NULL : catalog->db_address;
+        DIRRES *director;
+        LockRes();
+        director = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
+        UnlockRes();
+        if (!director) {
+            Pmsg0(0, "Error no Director resource defined.\n");
+           exit(1);
+        }
+        set_working_directory(director->working_directory);
+        db_name = catalog->db_name;
+        user = catalog->db_user;
+        password = catalog->db_password;
+        dbhost = catalog->db_address;
+        if (dbhost && dbhost[0] == 0) {
+           dbhost = NULL;
+        }
       }
    } else {
       if (argc > 5) {