From: Marco van Wieringen Date: Wed, 9 Jan 2013 15:10:10 +0000 (+0100) Subject: Fix bug #1975 new label ignored when first is duplicate. X-Git-Tag: Release-7.0.0~40 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bceea46c4bb5bbec7a169ee4cee9343028863b0b;p=bacula%2Fbacula Fix bug #1975 new label ignored when first is duplicate. When labelling a new volume, if an existing volume name is entered, subsequent entries are ignored and the original one is attempted each time. After the first call to db_get_media_record the MediaId of the media record is set and as such it will keep searching on MediaId instead of using the new entered named. So clear the MediaId and set the VolumeName and the call db_get_media_record so it will actually search for the new name and not for the already existing mediaid of the duplicate name entered before. --- diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index aa008f031d..93899cbd27 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -415,7 +415,10 @@ checkName: continue; } + /* Search by Media name so set VolumeName and clear MediaId. */ + mr.MediaId = 0; bstrncpy(mr.VolumeName, ua->cmd, sizeof(mr.VolumeName)); + /* If VolBytes are zero the Volume is not labeled */ if (db_get_media_record(ua->jcr, ua->db, &mr)) { if (mr.VolBytes != 0) {