summaryrefslogtreecommitdiff
path: root/src/bin/eolian/main.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-03-11 13:16:34 +0000
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-03-11 13:16:34 +0000
commit97adf6d52bd726520524873e846c3f847439cf55 (patch)
tree021a00e66989b9d69df5bd7b9f3daea4c82bd465 /src/bin/eolian/main.c
parentc420cbe9f02d134d691402a115c00674b5ba37ae (diff)
eolian generator: check fwrite return value currectly
This fixes CID 1327247. @fix
Diffstat (limited to '')
-rw-r--r--src/bin/eolian/main.c14
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)
105 return EINA_FALSE; 105 return EINA_FALSE;
106 } 106 }
107 107
108 if (eina_strbuf_length_get(buffer)) 108 size_t blen = eina_strbuf_length_get(buffer);
109 fwrite(eina_strbuf_string_get(buffer), 1, eina_strbuf_length_get(buffer), fd); 109 if (!blen)
110 return EINA_TRUE;
111
112 if (fwrite(eina_strbuf_string_get(buffer), 1, blen, fd) != blen)
113 {
114 fprintf(stderr, "eolian: could not write '%s' (%s)\n",
115 filename, strerror(errno));
116 fclose(fd);
117 return EINA_FALSE;
118 }
119
110 fclose(fd); 120 fclose(fd);
111 return EINA_TRUE; 121 return EINA_TRUE;
112} 122}