Skip to content

Commit

Permalink
fixed erroneous error check
Browse files Browse the repository at this point in the history
  • Loading branch information
fangfufu committed May 5, 2024
1 parent 1a20318 commit 28293b5
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,11 @@ static int Meta_read(Cache *cf)
return EIO;
}

/*
* TODO: This appears to be broken
*/
if (sizeof(long) != fread(&cf->time, sizeof(long), 1, fp) ||
sizeof(off_t) != fread(&cf->content_length, sizeof(off_t), 1, fp) ||
sizeof(int) != fread(&cf->blksz, sizeof(int), 1, fp) ||
sizeof(long) != fread(&cf->segbc, sizeof(long), 1, fp) ||
ferror(fp)) {
if ( 1 != fread(&cf->time, sizeof(long), 1, fp) ||
1 != fread(&cf->content_length, sizeof(off_t), 1, fp) ||
1 != fread(&cf->blksz, sizeof(int), 1, fp) ||
1 != fread(&cf->segbc, sizeof(long), 1, fp) ||
ferror(fp) ) {
lprintf(error, "error reading core metadata %s!\n", cf->path);
return EIO;
}
Expand Down

0 comments on commit 28293b5

Please sign in to comment.