eolian generator: close the file with zero write

This commit is contained in:
Daniel Kolesa 2016-03-11 16:19:53 +00:00
parent 97adf6d52b
commit d558c0122f
1 changed files with 6 additions and 4 deletions

View File

@ -105,20 +105,22 @@ _write_file(const char *filename, const Eina_Strbuf *buffer, Eina_Bool append)
return EINA_FALSE;
}
Eina_Bool ret = EINA_TRUE;
size_t blen = eina_strbuf_length_get(buffer);
if (!blen)
return EINA_TRUE;
goto end;
if (fwrite(eina_strbuf_string_get(buffer), 1, blen, fd) != blen)
{
fprintf(stderr, "eolian: could not write '%s' (%s)\n",
filename, strerror(errno));
fclose(fd);
return EINA_FALSE;
ret = EINA_FALSE;
}
end:
fclose(fd);
return EINA_TRUE;
return ret;
}
static Eina_Bool