summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-04-17 14:06:57 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2020-04-20 12:20:50 +0200
commitc80b0b1360ad0b9258c36a9e09a419e6acafd30c (patch)
tree8cad764fe2f63cca345d8d577d48350410513abe
parent000464c8424a17f2d22ebe54befd7a5190a1c538 (diff)
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 <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11724
-rw-r--r--src/bin/exactness/common.c15
1 files 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)
339 Exactness_Image *ex_img; 339 Exactness_Image *ex_img;
340 Eet_File *file; 340 Eet_File *file;
341 int i = 1; 341 int i = 1;
342 int bytes;
343 Eina_Bool ret = EINA_TRUE;
344
342 eet_init(); 345 eet_init();
343 file = eet_open(filename, EET_FILE_MODE_WRITE); 346 file = eet_open(filename, EET_FILE_MODE_WRITE);
344 eet_data_write(file, _unit_desc_make(), "cache", unit, EINA_TRUE); 347 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)
346 { 349 {
347 char entry[32]; 350 char entry[32];
348 sprintf(entry, "images/%d", i++); 351 sprintf(entry, "images/%d", i++);
349 eet_data_image_write(file, entry, 352 bytes = eet_data_image_write(file, entry, ex_img->pixels, ex_img->w, ex_img->h, 0xFF,
350 ex_img->pixels, ex_img->w, ex_img->h, 0xFF, 353 0, 100, EET_IMAGE_LOSSLESS);
351 0, 100, EET_IMAGE_LOSSLESS); 354 if (bytes == 0)
355 {
356 ret = EINA_FALSE;
357 break;
358 }
352 } 359 }
353 eet_close(file); 360 eet_close(file);
354 eet_shutdown(); 361 eet_shutdown();
355 return EINA_TRUE; 362 return ret;
356} 363}
357 364
358Eina_Bool 365Eina_Bool