mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
FileUtil: check for errors after a fread() in ReadFileToString()
This commit is contained in:
parent
4cc34e384c
commit
9e106e1d3d
@ -896,7 +896,8 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str) {
|
||||
success = true;
|
||||
} else {
|
||||
str.resize(len);
|
||||
success = fread(&str[0], 1, len, f) == len;
|
||||
int read = fread(&str[0], 1, len, f);
|
||||
success = read <= len && !ferror(f);
|
||||
}
|
||||
fclose(f);
|
||||
return success;
|
||||
|
Loading…
Reference in New Issue
Block a user