Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
filebundle: handle error code from stat() call
  • Loading branch information
perexg committed Aug 29, 2016
1 parent ed40c4d commit 1c1ef10
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/filebundle.c
Expand Up @@ -328,12 +328,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 1c1ef10

Please sign in to comment.