Skip to content

Commit

Permalink
Do not assume a filetype in digest_file
Browse files Browse the repository at this point in the history
Unfortunately, the ff_pkt->type is not set correctly when
digest_file is called during accurate comparison.

We get the value that stored before in ff_pkt->type by the last
file/directory that was processed, not by what we actually see.

That is why we do always calculate the digest now.

Fixes 462: windows file daemon and zero-length files in Inc backup Description
  • Loading branch information
pstorz authored and Marco van Wieringen committed May 22, 2015
1 parent 9d31fd5 commit b75dbb8
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/filed/verify.c
Expand Up @@ -259,26 +259,21 @@ int digest_file(JCR *jcr, FF_PKT *ff_pkt, DIGEST *digest)
{
BFILE bfd;

Dmsg0(50, "=== digest_file\n");
binit(&bfd);

if (ff_pkt->statp.st_size > 0 ||
ff_pkt->type == FT_RAW ||
ff_pkt->type == FT_FIFO) {
int noatime = bit_is_set(FO_NOATIME, ff_pkt->flags) ? O_NOATIME : 0;

if ((bopen(&bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0, ff_pkt->statp.st_rdev)) < 0) {
ff_pkt->ff_errno = errno;
berrno be;
be.set_errno(bfd.berrno);
Dmsg2(100, "Cannot open %s: ERR=%s\n", ff_pkt->fname, be.bstrerror());
Jmsg(jcr, M_ERROR, 1, _(" Cannot open %s: ERR=%s.\n"),
ff_pkt->fname, be.bstrerror());
return 1;
}
read_digest(&bfd, digest, jcr);
bclose(&bfd);
int noatime = bit_is_set(FO_NOATIME, ff_pkt->flags) ? O_NOATIME : 0;

if ((bopen(&bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0, ff_pkt->statp.st_rdev)) < 0) {
ff_pkt->ff_errno = errno;
berrno be;
be.set_errno(bfd.berrno);
Dmsg2(100, "Cannot open %s: ERR=%s\n", ff_pkt->fname, be.bstrerror());
Jmsg(jcr, M_ERROR, 1, _(" Cannot open %s: ERR=%s.\n"),
ff_pkt->fname, be.bstrerror());
return 1;
}
read_digest(&bfd, digest, jcr);
bclose(&bfd);

if (have_darwin_os) {
/*
Expand Down

0 comments on commit b75dbb8

Please sign in to comment.