diff options
Diffstat (limited to 'src/fpid.c')
-rw-r--r-- | src/fpid.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -42,7 +42,12 @@ long fpid_size(const char *filename) { long sz; FILE *fd = fopen(filename, "r"); - fseek(fd, 0, SEEK_END); + if (fd == NULL) + return -1; + if (fseek(fd, 0, SEEK_END) != 0) { + fclose(fd); + return -1; + } sz = ftell(fd); fclose(fd); return sz; |