Skip to content

Commit

Permalink
filebundle: handle error code from stat() call
Browse files Browse the repository at this point in the history
  • Loading branch information
perexg committed Aug 29, 2016
1 parent 8b92cf2 commit 52cbd5b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/filebundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,15 @@ fb_file *fb_open2
FILE *fp = tvh_fopen(path, "rb");
if (fp) {
struct stat st;
stat(path, &st);
ret = calloc(1, sizeof(fb_file));
ret->type = FB_DIRECT;
ret->size = st.st_size;
ret->gzip = 0;
ret->d.cur = fp;
if (!stat(path, &st)) {
ret = calloc(1, sizeof(fb_file));
ret->type = FB_DIRECT;
ret->size = st.st_size;
ret->gzip = 0;
ret->d.cur = fp;
} else {
fclose(fp);
}
}
}

Expand Down

0 comments on commit 52cbd5b

Please sign in to comment.