eolian: fread fix

Instead of 1 element of size N, we should read N elements of size 1 in
order to sensibly compare the result with the result of calling ftell.
This commit is contained in:
Daniel Kolesa 2014-08-04 10:56:15 +01:00
parent fc159fbcae
commit 8c677a1f0e
1 changed files with 3 additions and 2 deletions

View File

@ -67,10 +67,11 @@ _read_file(char *filename, Eina_Strbuf *buffer)
ERR("Couldnt allocate memory for file %s", filename);
goto end;
}
long actual_size = (long)fread(content, file_size, 1, fd);
long actual_size = (long)fread(content, 1, file_size, fd);
if (actual_size != file_size)
{
ERR("Couldnt read the %ld bytes of file %s", file_size, filename);
ERR("Couldnt read the %ld bytes of file %s (read %ld bytes)",
file_size, filename, actual_size);
free(content);
goto end;
}