From: Alain Spineux Date: Tue, 1 Dec 2020 09:17:12 +0000 (+0100) Subject: Fix org#2567 device capabilities overwritten X-Git-Tag: Release-9.6.7~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b7f1fcfe00ec7be6b40d7bd6d31a58eb634cc14;p=thirdparty%2Fbacula.git Fix org#2567 device capabilities overwritten - 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 --- diff --git a/bacula/src/stored/cloud_dev.c b/bacula/src/stored/cloud_dev.c index e9618df37..085b89c24 100644 --- a/bacula/src/stored/cloud_dev.c +++ b/bacula/src/stored/cloud_dev.c @@ -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) { diff --git a/bacula/src/stored/init_dev.c b/bacula/src/stored/init_dev.c index 90a198470..4bc9d4b3c 100644 --- a/bacula/src/stored/init_dev.c +++ b/bacula/src/stored/init_dev.c @@ -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 */