From 99d83b9017fb46eaeb9d7682fe263fced31c39a3 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 6 Aug 2014 03:07:35 +0200 Subject: common/utils: Silence compiler warning about ignored return value from fread() --- common/utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/utils.c b/common/utils.c index 80f7060..0f65f4a 100644 --- a/common/utils.c +++ b/common/utils.c @@ -161,7 +161,10 @@ void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *le } *buffer = (char*)malloc(sizeof(char)*(size+1)); - fread(*buffer, sizeof(char), size, f); + if (fread(*buffer, sizeof(char), size, f) != size) { + fclose(f); + return; + } fclose(f); *length = size; -- cgit v1.1-32-gdbae