]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/tools/dbcheck.c
Tweak fix MySQL quoting again :-(
[bacula/bacula] / bacula / src / tools / dbcheck.c
index c548364dbfeb6b30a0646e44a7bf16fdf45e58d7..6ed8a7c3e0b44ca82e2fb65356997a5aab63c308 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -120,6 +120,7 @@ static void usage()
 "       -d <nn>         set debug level to <nn>\n"
 "       -dt             print a timestamp in debug output\n"
 "       -f              fix inconsistencies\n"
+"       -t              test if client library is thread-safe\n"
 "       -v              verbose\n"
 "       -?              print this message\n\n");
    exit(1);
@@ -130,6 +131,7 @@ int main (int argc, char *argv[])
    int ch;
    const char *user, *password, *db_name, *dbhost;
    int dbport = 0;
+   bool test_thread=false;
    bool print_catalog=false;
    char *configfile = NULL;
    char *catalogname = NULL;
@@ -146,7 +148,7 @@ int main (int argc, char *argv[])
    memset(&id_list, 0, sizeof(id_list));
    memset(&name_list, 0, sizeof(name_list));
 
-   while ((ch = getopt(argc, argv, "bc:C:d:fvB?")) != -1) {
+   while ((ch = getopt(argc, argv, "bc:C:d:fvBt?")) != -1) {
       switch (ch) {
       case 'B':
          print_catalog = true;     /* get catalog information from config */
@@ -182,6 +184,9 @@ int main (int argc, char *argv[])
       case 'v':
          verbose++;
          break;
+      case 't':
+         test_thread=true;
+         break;
 
       case '?':
       default:
@@ -193,6 +198,16 @@ int main (int argc, char *argv[])
 
    OSDependentInit();
 
+   if (test_thread) {
+      /* When we will load the SQL backend with ldopen, this check would be
+       * moved after the database initialization. It will need a valid config
+       * file.
+       */
+      db_check_backend_thread_safe();
+      Pmsg0(0, _("OK - DB backend seems to be thread-safe.\n"));
+      exit(0);
+   }
+
    if (configfile) {
       CAT *catalog = NULL;
       int found = 0;
@@ -344,7 +359,7 @@ static void do_interactive_mode()
    else
       printf(_(" Verbose is off.\n"));
 
-   printf(_("Please select the fuction you want to perform.\n"));
+   printf(_("Please select the function you want to perform.\n"));
 
    while (!quit) {
       if (fix) {