diff options
author | yenatch <yenatch@gmail.com> | 2017-12-28 01:31:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-28 01:31:00 -0500 |
commit | e2b378f5e32ea1416fbc9ac5e96d23be244e4a6b (patch) | |
tree | 70fd1d4709150af457258763be04960931acd95b /tools/common.h | |
parent | da28d1a84b0499bead314e17ae2ff0d13eb03196 (diff) | |
parent | 9af2aee640b555f9f52503233bc06d299b99974d (diff) |
Merge pull request #442 from yenatch/fix-fread
fix fread warnings
Diffstat (limited to 'tools/common.h')
-rw-r--r-- | tools/common.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/common.h b/tools/common.h index bc877ccb9..4da0b2ef1 100644 --- a/tools/common.h +++ b/tools/common.h @@ -21,7 +21,10 @@ uint8_t *read_u8(char *filename, int *size) { *size = ftell(f); rewind(f); uint8_t *data = malloc(*size); - fread(data, 1, *size, f); + if (*size != (int)fread(data, 1, *size, f)) { + fprintf(stderr, "Could not read file: \"%s\"\n", filename); + exit(1); + } fclose(f); return data; } |