Verify fread(), fwrite(), and system() return values
These were starting to trigger compiler warning with recent glibc header files and gcc.
This commit is contained in:
parent
dd20838a7d
commit
308a4ec81a
3 changed files with 18 additions and 5 deletions
|
@ -220,7 +220,12 @@ char * os_readfile(const char *name, size_t *len)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fread(buf, 1, *len, f);
|
||||
if (fread(buf, 1, *len, f) != *len) {
|
||||
fclose(f);
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue