stefan pushed a commit to branch master.

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

commit c80b0b1360ad0b9258c36a9e09a419e6acafd30c
Author: Stefan Schmidt <[email protected]>
Date:   Fri Apr 17 14:06:57 2020 +0200

    exactness: handle case where eet_data_image_write() fails
    
    We never checked how many bytes had been written. Check on return and
    propagate error upwards to caller.
    
    CID: 1419856
    
    Reviewed-by: Marcel Hollerbach <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D11724
---
 src/bin/exactness/common.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/bin/exactness/common.c b/src/bin/exactness/common.c
index 8142d09bc1..d62d8fd519 100644
--- a/src/bin/exactness/common.c
+++ b/src/bin/exactness/common.c
@@ -339,6 +339,9 @@ exactness_unit_file_write(Exactness_Unit *unit, const char 
*filename)
    Exactness_Image *ex_img;
    Eet_File *file;
    int i = 1;
+   int bytes;
+   Eina_Bool ret = EINA_TRUE;
+
    eet_init();
    file = eet_open(filename, EET_FILE_MODE_WRITE);
    eet_data_write(file, _unit_desc_make(), "cache", unit, EINA_TRUE);
@@ -346,13 +349,17 @@ exactness_unit_file_write(Exactness_Unit *unit, const 
char *filename)
      {
         char entry[32];
         sprintf(entry, "images/%d", i++);
-        eet_data_image_write(file, entry,
-              ex_img->pixels, ex_img->w, ex_img->h, 0xFF,
-              0, 100, EET_IMAGE_LOSSLESS);
+        bytes = eet_data_image_write(file, entry, ex_img->pixels, ex_img->w, 
ex_img->h, 0xFF,
+                                     0, 100, EET_IMAGE_LOSSLESS);
+        if (bytes == 0)
+          {
+             ret = EINA_FALSE;
+             break;
+         }
      }
    eet_close(file);
    eet_shutdown();
-   return EINA_TRUE;
+   return ret;
 }
 
 Eina_Bool

-- 


Reply via email to