]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix org#2567 device capabilities overwritten
authorAlain Spineux <alain@baculasystems.com>
Tue, 1 Dec 2020 09:17:12 +0000 (10:17 +0100)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Dec 2020 14:15:44 +0000 (15:15 +0100)
- The problem is that the ?numerous? "dev->capabilities |= CAP_LSEEK"
  are overwritten by dev->device_generic_init() in init_dev() that
  does a "dev->capabilities = device->cap_bits;"

- Now Bacula display the second line below just after the 1st one when
  appending a already used volume
= 01-Dec 09:34 127.0.0.1-sd JobId 1: Volume "Vol0001" previously written, moving to end of data.
+ 01-Dec 09:34 127.0.0.1-sd JobId 1: Ready to append to end of Volume "Vol0001" size=21,857,409
  this can be seen in restart-job-test

bacula/src/stored/cloud_dev.c
bacula/src/stored/init_dev.c

index e9618df37d44ab501102d5d4e750baf1c7068850..085b89c24b98cde93f3a80723a557f5663b80a8d 100644 (file)
@@ -73,7 +73,7 @@ DEVICE *BaculaSDdriver(JCR *jcr, DEVRES *device)
       return NULL;
    }
    dev = New(cloud_dev(jcr, device));
-   dev->capabilities |= CAP_LSEEK;
+   dev->capabilities |= CAP_LSEEK;  /* ATTN overwritten in init_dev() later */
    return dev;
 }
 
@@ -652,7 +652,7 @@ cloud_dev::cloud_dev(JCR *jcr, DEVRES *device)
 {
    Enter(dbglvl);
    m_fd = -1;
-   capabilities |= CAP_LSEEK;
+   capabilities |= CAP_LSEEK;   /* ATTN overwritten in init_dev() later */
 
    /* Initialize Cloud driver */
    if (!driver) {
index 90a1984701943cf4482161c59cea07b50b5feb84..4bc9d4b3c12873f80333e1f58c170de533aa5150 100644 (file)
@@ -222,6 +222,10 @@ DEVICE *init_dev(JCR *jcr, DEVRES *device, bool adata, bstatcollect *statcollect
    /* Do device specific initialization */
    dev->device_specific_init(jcr, device);
 
+   if (device->dev_type == B_FILE_DEV || device->dev_type == B_CLOUD_DEV) {
+      dev->capabilities |= CAP_LSEEK;
+   }
+
    /* ***FIXME*** move to fifo driver */
    if (dev->is_fifo()) {
       dev->capabilities |= CAP_STREAM; /* set stream device */