diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-03-11 13:16:34 +0000 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-03-11 13:16:34 +0000 |
commit | 97adf6d52bd726520524873e846c3f847439cf55 (patch) | |
tree | 021a00e66989b9d69df5bd7b9f3daea4c82bd465 | |
parent | c420cbe9f02d134d691402a115c00674b5ba37ae (diff) | |
download | efl-97adf6d52bd726520524873e846c3f847439cf55.tar.gz |
eolian generator: check fwrite return value currectly
This fixes CID 1327247.
@fix
-rw-r--r-- | src/bin/eolian/main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 77ad87f89f..f545960ae1 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -105,8 +105,18 @@ _write_file(const char *filename, const Eina_Strbuf *buffer, Eina_Bool append) return EINA_FALSE; } - if (eina_strbuf_length_get(buffer)) - fwrite(eina_strbuf_string_get(buffer), 1, eina_strbuf_length_get(buffer), fd); + size_t blen = eina_strbuf_length_get(buffer); + if (!blen) + return EINA_TRUE; + + 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; + } + fclose(fd); return EINA_TRUE; } |