From ccfedace8c3287d287ab10335bae4dc7331c7982 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 12 Sep 2007 07:18:32 +0000 Subject: [PATCH] kes Fix migration code to get correct Volume name with multiple volumes by skipping |. Fixes bug #936. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5530 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/2.2.3-migrate-vol.patch | 28 ++++++++++++++++++++++++++ bacula/src/dird/migrate.c | 6 ++++-- bacula/technotes-2.3 | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 bacula/patches/2.2.3-migrate-vol.patch diff --git a/bacula/patches/2.2.3-migrate-vol.patch b/bacula/patches/2.2.3-migrate-vol.patch new file mode 100644 index 0000000000..cdb0a366cb --- /dev/null +++ b/bacula/patches/2.2.3-migrate-vol.patch @@ -0,0 +1,28 @@ + This patch corrects a bug where the last volume of a migration + job is incorrectly found producing an error. This fixes bug #936. + Apply the patch to 2.2.3 (and possibly earlier 2.2.x versions) with: + + cd + patch -p0 <2.2.3-migrate-vol.patch + ./configure (your options) + make + ... + make install + +Index: src/dird/migrate.c +=================================================================== +--- src/dird/migrate.c (revision 5507) ++++ src/dird/migrate.c (working copy) +@@ -1098,8 +1098,10 @@ + if (mig_jcr->VolumeName[0]) { + /* Find last volume name. Multiple vols are separated by | */ + char *p = strrchr(mig_jcr->VolumeName, '|'); +- if (!p) { +- p = mig_jcr->VolumeName; ++ if (p) { ++ p++; /* skip | */ ++ } else { ++ p = mig_jcr->VolumeName; /* no |, take full name */ + } + bstrncpy(mr.VolumeName, p, sizeof(mr.VolumeName)); + if (!db_get_media_record(jcr, jcr->db, &mr)) { diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 223328c1f5..c0f183d05a 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -1098,8 +1098,10 @@ void migration_cleanup(JCR *jcr, int TermCode) if (mig_jcr->VolumeName[0]) { /* Find last volume name. Multiple vols are separated by | */ char *p = strrchr(mig_jcr->VolumeName, '|'); - if (!p) { - p = mig_jcr->VolumeName; + if (p) { + p++; /* skip | */ + } else { + p = mig_jcr->VolumeName; /* no |, take full name */ } bstrncpy(mr.VolumeName, p, sizeof(mr.VolumeName)); if (!db_get_media_record(jcr, jcr->db, &mr)) { diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 1390c5c1eb..81abacb685 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -2,6 +2,8 @@ General: 12Sep07 +kes Fix migration code to get correct Volume name with multiple volumes + by skipping |. Fixes bug #936. kes Implement patch supplied by Landon to fix bug #944 where using TLS with bconsole uses 99+% of the CPU. kes Note, you need GTK >= 2.10 to be able to link the Tray Monitor -- 2.39.5