Small fix on entry load file

In case a file can't be completely read, return what could be read so
far.



SVN revision: 54152
This commit is contained in:
Bruno Dilly 2010-11-04 13:59:42 +00:00
parent 24b7f9bcaa
commit c7005dd59b
1 changed files with 4 additions and 1 deletions

View File

@ -271,8 +271,11 @@ _load_file(const char *file)
if (!f) return NULL;
while ((size = fread(buf, 1, sizeof(buf), f)))
{
char *tmp_text;
buf[size] = 0;
text = _buf_append(text, buf, &len, &alloc);
tmp_text = _buf_append(text, buf, &len, &alloc);
if (!tmp_text) break;
text = tmp_text;
}
fclose(f);
return text;