more stability and error handling improvements

This commit is contained in:
Fufu Fang 2019-04-23 12:55:15 +01:00
parent fe079f6266
commit cba66c58fd
1 changed files with 8 additions and 0 deletions

View File

@ -159,6 +159,14 @@ blksz: %d, segbc: %ld\n", cf->content_length, cf->blksz, cf->segbc);
/* Read all the segment */
nmemb = fread(cf->seg, sizeof(Seg), cf->segbc, fp);
/* We shouldn't have gone past the end of the file */
if (feof(fp)) {
/* reached EOF */
fprintf(stderr,
"Meta_read(): attempted to read past the end of the file!\n");
res = EINCONSIST;
}
/* Error checking for fread */
if (ferror(fp)) {
fprintf(stderr,