additional error tracking on reading file streams if fseek fails

This commit is contained in:
unknown 2015-02-19 17:57:49 -05:00
parent 586c620609
commit a8fea21f11

View File

@ -107,13 +107,15 @@ static bool read_generic_file(const char *path, void **buf, ssize_t *len)
if (!file)
goto error;
fseek(file, 0, SEEK_END);
if (fseek(file, 0, SEEK_END) != 0)
goto error;
_len = ftell(file);
if (_len < 0)
goto error;
rewind(file);
if (fseek(file, 0, SEEK_SET) != 0)
goto error;
rom_buf = malloc(_len + 1);