Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ Bacula® is a registered trademark of Kern Sibbald.
The licensor of Bacula is the Free Software Foundation Europe
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
do_read = true;
}
- Dmsg1(100, "do_read=%d\n", do_read);
+ Dmsg1(400, "do_read=%d\n", do_read);
if (do_read) {
btimer_t *tid;
/* Check for sparse blocks */
if (ff_pkt->flags & FO_SPARSE) {
ser_declare;
- bool haveBlock = true;
+ bool allZeros = false;
if (sd->msglen == rsize &&
fileAddr+sd->msglen < (uint64_t)ff_pkt->statp.st_size ||
((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) &&
(uint64_t)ff_pkt->statp.st_size == 0)) {
- haveBlock = !is_buf_zero(rbuf, rsize);
+ allZeros = is_buf_zero(rbuf, rsize);
}
- if (haveBlock) {
+ if (!allZeros) {
+ /* Put file address as first data in buffer */
ser_begin(wbuf, SPARSE_FADDR_SIZE);
ser_uint64(fileAddr); /* store fileAddr in begin of buffer */
}
fileAddr += sd->msglen; /* update file address */
- if (!haveBlock) {
+ /* Skip block of all zeros */
+ if (allZeros) {
continue; /* skip block of zeros */
}
}
/* Copy to first path separator -- Win32 might have c: ... */
while (*in && !IsPathSeparator(*in)) {
- *out++ = *in++;
+ out++; in++;
}
- *out++ = *in++;
+ out++; in++;
numsep++; /* one separator seen */
for (stripped=0; stripped<count && *in; stripped++) {
while (*in && !IsPathSeparator(*in)) {
ff_pkt->link_save = get_pool_memory(PM_FNAME);
}
pm_strcpy(ff_pkt->fname_save, ff_pkt->fname);
+ if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ pm_strcpy(ff_pkt->link_save, ff_pkt->link);
+ Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
+ strlen(ff_pkt->link));
+ sm_check(__FILE__, __LINE__, true);
+ }
/*
* Strip path. If it doesn't succeed put it back. If
* Do not strip symlinks.
* I.e. if either stripping fails don't strip anything.
*/
- if (do_strip(ff_pkt->strip_path, ff_pkt->fname)) {
- /* Strip links but not symlinks */
- if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
- pm_strcpy(ff_pkt->link_save, ff_pkt->link);
- if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
- strcpy(ff_pkt->link, ff_pkt->link_save);
- strcpy(ff_pkt->fname, ff_pkt->fname_save);
- }
- }
- } else {
- strcpy(ff_pkt->fname, ff_pkt->fname_save);
+ if (!do_strip(ff_pkt->strip_path, ff_pkt->fname)) {
+ unstrip_path(ff_pkt);
+ goto rtn;
}
- Dmsg2(200, "fname=%s stripped=%s\n", ff_pkt->fname_save, ff_pkt->fname);
+ /* Strip links but not symlinks */
+ if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
+ unstrip_path(ff_pkt);
+ }
+ }
+
+rtn:
+ Dmsg3(100, "fname=%s stripped=%s link=%s\n", ff_pkt->fname_save, ff_pkt->fname,
+ ff_pkt->link);
}
void unstrip_path(FF_PKT *ff_pkt)
}
strcpy(ff_pkt->fname, ff_pkt->fname_save);
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ Dmsg2(500, "strcpy link=%s link_save=%s\n", ff_pkt->link,
+ ff_pkt->link_save);
strcpy(ff_pkt->link, ff_pkt->link_save);
+ Dmsg2(500, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
+ strlen(ff_pkt->link_save));
+ sm_check(__FILE__, __LINE__, true);
}
}