diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-09 07:16:43 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-09 07:16:43 +0100 |
commit | 37ffeeb5446fedc5f205f435c16dea1dce8ec3ad (patch) | |
tree | f2897249988d08a6f9dee1a4866362eea498ed9d | |
parent | 919469ebd185e8a38738b358131789c012802c24 (diff) | |
download | tr8vm-37ffeeb5446fedc5f205f435c16dea1dce8ec3ad.tar.gz tr8vm-37ffeeb5446fedc5f205f435c16dea1dce8ec3ad.zip |
Check for error
-rw-r--r-- | tr8vm.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) { |