From a10395f4bc8a823b03954b6db33d236ab05523df Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 16 Jul 2004 22:14:28 +0000 Subject: [PATCH] Fix -c option in dbcheck git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1474 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/tools/dbcheck.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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) { -- 2.39.5