aboutsummaryrefslogtreecommitdiff
path: root/tr8vm.c
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-09 07:16:43 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-09 07:16:43 +0100
commit37ffeeb5446fedc5f205f435c16dea1dce8ec3ad (patch)
treef2897249988d08a6f9dee1a4866362eea498ed9d /tr8vm.c
parent919469ebd185e8a38738b358131789c012802c24 (diff)
downloadtr8vm-37ffeeb5446fedc5f205f435c16dea1dce8ec3ad.tar.gz
tr8vm-37ffeeb5446fedc5f205f435c16dea1dce8ec3ad.zip
Check for error
Diffstat (limited to 'tr8vm.c')
-rw-r--r--tr8vm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tr8vm.c b/tr8vm.c
index 57740d9..65dc86b 100644
--- a/tr8vm.c
+++ b/tr8vm.c
@@ -214,7 +214,12 @@ int main(int argc, char *argv[])
fprintf(stderr, "Error opening input\n");
return 1;
}
- fseek(fd, 0, SEEK_END);
+ if (fseek(fd, 0, SEEK_END) == -1)
+ {
+ fclose(fd);
+ fprintf(stderr, "Error opening input\n");
+ return 1;
+ }
size = ftell(fd);
if (size > UINT16_MAX + 1)
{