Skip to content

Commit

Permalink
XrdApps::JCache fix bug introduced when correcting main header offset
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 18, 2024
1 parent 11a12ec commit c144edc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/XrdApps/XrdClJCachePlugin/cache/Journal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ int Journal::read_journal() {
reset();
return cachesize; // sizeof (jheader_t) ;
}
} else {
header_t *header = reinterpret_cast<header_t *>(buffer);
journal.insert(header->offset, header->offset + header->size,
totalBytesRead);
totalBytesRead += header->size; // size of the fragment
totalBytesRead += bytesRead; // size of the header
}
header_t *header = reinterpret_cast<header_t *>(buffer);
journal.insert(header->offset, header->offset + header->size,
totalBytesRead);
totalBytesRead += header->size; // size of the fragment
totalBytesRead += bytesRead; // size of the header
} while (bytesRead);
return totalBytesRead;
}
Expand Down Expand Up @@ -384,7 +385,7 @@ int Journal::update_cache(std::vector<chunk_t> &updates) {

for (auto &u : updates) {
rc = ::pwrite(fd, u.buff, u.size,
u.offset+sizeof(jheader_t)); // TODO is it safe to assume it will write it all
u.offset); // TODO is it safe to assume it will write it all

if (rc <= 0) {
return errno;
Expand Down

0 comments on commit c144edc

Please sign in to comment.