From 40305f205e75f1d6d7ad1ee11d57b5d72a783270 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 28 Dec 2017 01:25:25 -0500 Subject: fix unused fread return value warnings --- tools/common.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/common.h') 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; } -- cgit v1.2.3