From: Kern Sibbald Date: Mon, 14 May 2007 08:45:32 +0000 (+0000) Subject: Ensure that calls to find_jobids_from_mediaid_list() check count before X-Git-Tag: Release-7.0.0~6352 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=90ae6d80ba3a746b1e44c12d77ffb72876cfb05d;p=bacula%2Fbacula Ensure that calls to find_jobids_from_mediaid_list() check count before continuing in migration code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4779 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index f7aec4eca3..3484f13248 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -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; } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 22f6fd5cb5..8544481a76 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -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 13May07