From: Kern Sibbald Date: Fri, 16 Jul 2004 22:14:28 +0000 (+0000) Subject: Fix -c option in dbcheck X-Git-Tag: Release-1.35.1~60 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a10395f4bc8a823b03954b6db33d236ab05523df;p=bacula%2Fbacula Fix -c option in dbcheck git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1474 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index bfbb3a56fe..c4af96203f 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -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) {