summaryrefslogtreecommitdiffstats
path: root/src/fpid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fpid.c')
-rw-r--r--src/fpid.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fpid.c b/src/fpid.c
index 60c1381..7126719 100644
--- a/src/fpid.c
+++ b/src/fpid.c
@@ -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;