Commit bbefcb39 authored by Shawn Landden's avatar Shawn Landden

check if fread() did not read anything

    CC            host/arch/arm/lib/crossystem_arch.o
host/arch/arm/lib/crossystem_arch.c: In function 'ReadFdtValue':
host/arch/arm/lib/crossystem_arch.c:92:3: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]
parent a11f2ea6
......@@ -82,6 +82,7 @@ static int ReadFdtValue(const char *property, int *value) {
char filename[FNAME_SIZE];
FILE *file;
int data = 0;
int r;
snprintf(filename, sizeof(filename), FDT_BASE_PATH "/%s", property);
file = fopen(filename, "rb");
......@@ -90,7 +91,11 @@ static int ReadFdtValue(const char *property, int *value) {
return E_FILEOP;
fread(&data, 1, sizeof(data), file);
r = fread(&data, 1, sizeof(data), file);
if (!r) {
return E_FILEOP;
if (value)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment