fix warning about ignoring fread() return value
This commit is contained in:
parent
eb0530004d
commit
0d78e3cf4f
@ -18,9 +18,14 @@ static char *loadFile(const char *fname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
char * buff = malloc(st.st_size + 1);
|
char * buff = malloc(st.st_size + 1);
|
||||||
FILE *fil = fopen(fname, "r");
|
FILE *fil = fopen(fname, "r");
|
||||||
fread(buff, st.st_size, 1, fil);
|
int bytes_read = fread(buff, st.st_size, 1, fil);
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
buff[st.st_size] = '\0';
|
buff[st.st_size] = '\0';
|
||||||
|
if (bytes_read != st.st_size)
|
||||||
|
{
|
||||||
|
free(buff);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user