fix warning about ignoring fread() return value

This commit is contained in:
Josh Holtrop 2011-05-25 16:13:00 -04:00
parent eb0530004d
commit 0d78e3cf4f

View File

@ -18,9 +18,14 @@ static char *loadFile(const char *fname)
return NULL;
char * buff = malloc(st.st_size + 1);
FILE *fil = fopen(fname, "r");
fread(buff, st.st_size, 1, fil);
int bytes_read = fread(buff, st.st_size, 1, fil);
fclose(fil);
buff[st.st_size] = '\0';
if (bytes_read != st.st_size)
{
free(buff);
return NULL;
}
return buff;
}