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:
Jouni Malinen 2008-10-29 19:33:24 +02:00 committed by Jouni Malinen
parent dd20838a7d
commit 308a4ec81a
3 changed files with 18 additions and 5 deletions

View file

@ -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;