]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.4.2-null-vol.patch
ebl Backport of the btraceback script that keeps trace file on working dir
[bacula/bacula] / bacula / patches / 2.4.2-null-vol.patch
1
2   This patch fixes an error when reading (restore, migration, Vbackup) and
3   SD acquire.c must switch drives.  The error message complained of a NULL
4   volume name.
5
6   Apply this patch to version 2.4.2 with:
7
8   cd <bacula-source>
9   patch -p0 <2.4.2-null-vol.patch
10   ./configure <your-options>
11   make
12   ...
13   make install
14
15
16 Index: src/stored/acquire.c
17 ===================================================================
18 --- src/stored/acquire.c        (revision 7500)
19 +++ src/stored/acquire.c        (working copy)
20 @@ -111,10 +111,10 @@
21        DIRSTORE *store;
22        int stat;
23  
24 -      Jmsg3(jcr, M_INFO, 0, _("Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
25 +      Jmsg3(jcr, M_INFO, 0, _("Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
26                                "  device=%s\n"), 
27              dcr->media_type, dev->device->media_type, dev->print_name());
28 -      Dmsg3(50, "Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
29 +      Dmsg3(50, "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
30                                "  device=%s\n", 
31              dcr->media_type, dev->device->media_type, dev->print_name());
32  
33 @@ -147,9 +147,9 @@
34           dev = dcr->dev;                     /* get new device pointer */
35           dev->dblock(BST_DOING_ACQUIRE); 
36           dcr->VolumeName[0] = 0;
37 -         Jmsg(jcr, M_INFO, 0, _("Media Type change.  New device %s chosen.\n"),
38 +         Jmsg(jcr, M_INFO, 0, _("Media Type change.  New read device %s chosen.\n"),
39              dev->print_name());
40 -         Dmsg1(50, "Media Type change.  New device %s chosen.\n", dev->print_name());
41 +         Dmsg1(50, "Media Type change.  New read device %s chosen.\n", dev->print_name());
42  
43           bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
44           bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
45 @@ -430,11 +430,14 @@
46     dcr->clear_reserved();
47  
48     if (dev->can_read()) {
49 +      VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
50        dev->clear_read();              /* clear read bit */
51 -      Dmsg0(100, "dir_update_vol_info. Release0\n");
52 -      dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
53 -      volume_unused(dcr);
54 -
55 +      Dmsg2(000, "dir_update_vol_info. label=%d Vol=%s\n",
56 +         dev->is_labeled(), vol->VolCatName);
57 +      if (dev->is_labeled() && vol->VolCatName[0] != 0) {
58 +         dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
59 +         volume_unused(dcr);
60 +      }
61     } else if (dev->num_writers > 0) {
62        /* 
63         * Note if WEOT is set, we are at the end of the tape