q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=97adf6d52bd726520524873e846c3f847439cf55

commit 97adf6d52bd726520524873e846c3f847439cf55
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Fri Mar 11 13:16:34 2016 +0000

    eolian generator: check fwrite return value currectly
    
    This fixes CID 1327247.
    
    @fix
---
 src/bin/eolian/main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 77ad87f..f545960 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;
 }

-- 


Reply via email to