]> git.sur5r.net Git - bacula/bacula/commitdiff
Ensure that calls to find_jobids_from_mediaid_list() check count before
authorKern Sibbald <kern@sibbald.com>
Mon, 14 May 2007 08:45:32 +0000 (08:45 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 14 May 2007 08:45:32 +0000 (08:45 +0000)
     continuing in migration code.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4779 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/migrate.c
bacula/technotes-2.1

index f7aec4eca3c3c405c97da279dc60126b3a61c30d..3484f1324898d3e1bf029e9c297c37b1612afcda 100644 (file)
@@ -722,6 +722,9 @@ static int get_job_to_migrate(JCR *jcr)
             if (!find_jobids_from_mediaid_list(jcr, &mid, "Volumes")) {
                continue;
             }
+            if (mid.count == 0) {
+               continue;                  /* nothing returned */
+            }
             if (i != 0) {
                pm_strcat(jids.list, ",");
             }
@@ -887,8 +890,7 @@ static bool find_mediaid_then_jobids(JCR *jcr, idpkt *ids, const char *query1,
       ok = true;         /* Not an error */
       goto bail_out;
    } else if (ids->count != 1) {
-      Jmsg(jcr, M_FATAL, 0, _("SQL error. Expected 1 MediaId got %d\n"), 
-         ids->count);
+      Jmsg(jcr, M_FATAL, 0, _("SQL error. Expected 1 MediaId got %d\n"), ids->count);
       goto bail_out;
    }
    Dmsg2(dbglevel, "%s MediaIds=%s\n", type, ids->list);
@@ -899,6 +901,12 @@ bail_out:
    return ok;
 }
 
+/* 
+ * This routine returns:
+ *    false       if an error occurred
+ *    true        otherwise
+ *    ids.count   number of jobids found (may be zero)
+ */       
 static bool find_jobids_from_mediaid_list(JCR *jcr, idpkt *ids, const char *type) 
 {
    bool ok = false;
@@ -914,6 +922,7 @@ static bool find_jobids_from_mediaid_list(JCR *jcr, idpkt *ids, const char *type
       Jmsg(jcr, M_INFO, 0, _("No %ss found to migrate.\n"), type);
    }
    ok = true;
+
 bail_out:
    return ok;
 }
index 22f6fd5cb58d6e28a01b28b462c7a9f6c4c25837..8544481a760ced3625afc1370544efcca6b55bef 100644 (file)
@@ -2,6 +2,8 @@
 
 General:
 14May07 
+kes  Ensure that calls to find_jobids_from_mediaid_list() check count before
+     continuing in migration code.
 kes  Apply implementation of tray-monitor font derived from gnome-console
      submitted by Andreas Piesk <a.piesk@gmx.net>
 13May07