diff options
author | yenatch <yenatch@gmail.com> | 2017-12-28 01:25:25 -0500 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2017-12-28 01:25:25 -0500 |
commit | 40305f205e75f1d6d7ad1ee11d57b5d72a783270 (patch) | |
tree | b36dc0c971cce4ab4f487949a4e02bf19db9f229 /tools/common.h | |
parent | bad9e33530af8cdc29ce5629df682fc7915bfff0 (diff) |
fix unused fread return value 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; } |