aboutsummaryrefslogtreecommitdiff
path: root/lib/fs.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-04-09 13:46:36 -0400
committerGitHub <noreply@github.com>2020-04-09 13:46:36 -0400
commit0f0dd17bc5a2c3149684f2a50fbefae09e49be72 (patch)
treec7c207c995fcc69d9f0b0d338120676853ec3a49 /lib/fs.c
parentbda58bb6886c1fa49a4ecfc5812f38921fb9e7f4 (diff)
parent5fab65a9f8c026ccd9e4c58cbe1d2aea06c28305 (diff)
downloadspmc-0f0dd17bc5a2c3149684f2a50fbefae09e49be72.tar.gz
Merge pull request #17 from jhunkeler/test-get_file_size
Test get file size
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;