]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_output.c
Tweak restore path prompt
[bacula/bacula] / bacula / src / dird / ua_output.c
index fd8a973547b2feab9d2ce269eef59ce1e579089e..d7e93d0795062f8a5e2e5ac08d188140f41b9abe 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
 
    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.
@@ -280,7 +280,6 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
 
    memset(&jr, 0, sizeof(jr));
    memset(&pr, 0, sizeof(pr));
-   memset(&mr, 0, sizeof(mr));
 
    Dmsg1(20, "list: %s\n", cmd);
 
@@ -288,15 +287,16 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
       ua->error_msg(_("Hey! DB is NULL\n"));
    }
 
+   /* Apply any limit */
+   j = find_arg_with_value(ua, NT_("limit"));
+   if (j >= 0) {
+      jr.limit = atoi(ua->argv[j]);
+   }
+
    /* Scan arguments looking for things to do */
    for (i=1; i<ua->argc; i++) {
       /* List JOBS */
       if (strcasecmp(ua->argk[i], NT_("jobs")) == 0) {
-         /* Apply any limit */
-         j = find_arg_with_value(ua, NT_("limit"));
-         if (j >= 0) {
-            jr.limit = atoi(ua->argv[j]);
-         }
          db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
 
          /* List JOBTOTALS */
@@ -535,7 +535,6 @@ static bool list_nextvol(UAContext *ua, int ndays)
    MEDIA_DBR mr;
    POOL_DBR pr;
 
-   memset(&mr, 0, sizeof(mr));
    int i = find_arg_with_value(ua, "job");
    if (i <= 0) {
       if ((job = select_job_resource(ua)) == NULL) {
@@ -568,7 +567,7 @@ static bool list_nextvol(UAContext *ua, int ndays)
       }
       mr.PoolId = jcr->jr.PoolId;
       get_job_storage(&store, job, run);
-      mr.StorageId = store.store->StorageId;
+      set_storageid_in_mr(store.store, &mr);
       /* no need to set ScratchPoolId, since we use fnv_no_create_vol */
       if (!find_next_volume_for_append(jcr, &mr, 1, fnv_no_create_vol, fnv_prune)) {
          ua->error_msg(_("Could not find next Volume for Job %s (Pool=%s, Level=%s).\n"),
@@ -582,8 +581,10 @@ static bool list_nextvol(UAContext *ua, int ndays)
    }
 
 get_out:
-   db_close_database(jcr, jcr->db);
-   jcr->db = NULL;
+   if (jcr->db) {
+      db_close_database(jcr, jcr->db);
+      jcr->db = NULL;
+   }
    free_jcr(jcr);
    if (!found) {
       ua->error_msg(_("Could not find next Volume for Job %s.\n"),
@@ -706,11 +707,12 @@ bool complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool)
    }
 
    Dmsg0(100, "complete_jcr open db\n");
-   jcr->db = jcr->db=db_init(jcr, jcr->catalog->db_driver, jcr->catalog->db_name, 
-                      jcr->catalog->db_user,
-                      jcr->catalog->db_password, jcr->catalog->db_address,
-                      jcr->catalog->db_port, jcr->catalog->db_socket,
-                      jcr->catalog->mult_db_connections);
+   jcr->db = db_init_database(jcr, jcr->catalog->db_driver, jcr->catalog->db_name, 
+                              jcr->catalog->db_user,
+                              jcr->catalog->db_password, jcr->catalog->db_address,
+                              jcr->catalog->db_port, jcr->catalog->db_socket,
+                              jcr->catalog->mult_db_connections, 
+                              jcr->catalog->disable_batch_insert);
    if (!jcr->db || !db_open_database(jcr, jcr->db)) {
       Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"),
                  jcr->catalog->db_name);