aboutsummaryrefslogtreecommitdiff
path: root/lib/fs.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2020-04-09 13:15:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2020-04-09 13:15:52 -0400
commit6132127cd75b1265e84daad00f3c1e5dfeef0e2c (patch)
tree4aaaf6e4f92634ce29cd5bcb5206d8df2fe6d613 /lib/fs.c
parentbda58bb6886c1fa49a4ecfc5812f38921fb9e7f4 (diff)
downloadspmc-6132127cd75b1265e84daad00f3c1e5dfeef0e2c.tar.gz
Fail if seek fails
Diffstat (limited to 'lib/fs.c')
-rw-r--r--lib/fs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/fs.c b/lib/fs.c
index e285916..890c261 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -388,7 +388,9 @@ long int get_file_size(const char *filename) {
if (!fp) {
return -1;
}
- fseek(fp, 0, SEEK_END);
+ if (fseek(fp, 0, SEEK_END) < 0) {
+ return -1;
+ }
result = ftell(fp);
fclose(fp);
return result;