]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.2.x/2.2.6-bcopy.patch
Cleanup patches a bit
[bacula/bacula] / bacula / patches / 2.2.x / 2.2.6-bcopy.patch
1
2  This patch fixes bcopy so that it produces correct Volumes.
3  It fixes bug #1022.
4
5  Apply this patch to version 2.2.6 and possibly any 2.2.x version with:
6
7  cd <bacula-source>
8  patch -p0 2.2.6-bcopy.patch
9  ./configure <your-options>
10  make
11  ...
12  make install
13
14
15 Index: src/stored/bcopy.c
16 ===================================================================
17 --- src/stored/bcopy.c  (revision 6010)
18 +++ src/stored/bcopy.c  (working copy)
19 @@ -89,6 +89,7 @@
20     char *iVolumeName = NULL;
21     char *oVolumeName = NULL;
22     bool ignore_label_errors = false;
23 +   bool ok;
24  
25     setlocale(LC_ALL, "");
26     bindtextdomain("bacula", LOCALEDIR);
27 @@ -199,9 +200,11 @@
28     }
29     out_block = out_jcr->dcr->block;
30  
31 -   read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
32 -   if (!write_block_to_device(out_jcr->dcr)) {
33 -      Pmsg0(000, _("Write of last block failed.\n"));
34 +   ok = read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
35 +   if (ok || out_dev->can_write()) {
36 +      if (!write_block_to_device(out_jcr->dcr)) {
37 +         Pmsg0(000, _("Write of last block failed.\n"));
38 +      }
39     }
40  
41     Pmsg2(000, _("%u Jobs copied. %u records copied.\n"), jobs, records);
42 @@ -253,6 +256,7 @@
43                    out_dev->print_name(), out_dev->bstrerror());
44                 Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
45                       out_dev->bstrerror());
46 +               return false;
47              }
48           }
49           if (!write_block_to_device(out_jcr->dcr)) {
50 @@ -260,8 +264,9 @@
51                 out_dev->print_name(), out_dev->bstrerror());
52              Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
53                    out_dev->bstrerror());
54 +            return false;
55           }
56 -         break;
57 +         return true;
58        case EOM_LABEL:
59           Pmsg0(000, _("EOM label not copied.\n"));
60           return true;
61 @@ -269,7 +274,7 @@
62           Pmsg0(000, _("EOT label not copied.\n"));
63           return true;
64        default:
65 -         break;
66 +         return true;
67        }
68     }
69  
70 @@ -283,7 +288,7 @@
71              out_dev->print_name(), out_dev->bstrerror());
72           Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
73                 out_dev->bstrerror());
74 -         break;
75 +         return false;
76        }
77     }
78     return true;