Fix: unused value

This commit is contained in:
Dorian Zedler 2022-07-20 15:55:33 +02:00
parent 1c42f4036f
commit 584cba2bae
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -47,9 +47,9 @@ uint8_t* read_file(const char* path, size_t* size) {
return NULL; return NULL;
} }
fread(data, 1, statOfFile.st_size, f); size_t bytes_read = fread(data, 1, statOfFile.st_size, f);
if (ferror(f)) { if (bytes_read == 0 || ferror(f)) {
fclose(f); fclose(f);
if (errno == 0) errno = EIO; if (errno == 0) errno = EIO;
return NULL; return NULL;