billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=b327ff2f191c62fef912bf05b27c91c908e023be

commit b327ff2f191c62fef912bf05b27c91c908e023be
Author: Boris Faure <[email protected]>
Date:   Tue Nov 12 10:56:41 2019 +0100

    config: add error messages when saving config
---
 src/bin/config.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/bin/config.c b/src/bin/config.c
index 52ff2d2..3566d61 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -216,6 +216,7 @@ config_save(Config *config)
    char buf[PATH_MAX], buf2[PATH_MAX];
    const char *cfgdir;
    int ok;
+   Eet_Error err;
 
    EINA_SAFETY_ON_NULL_RETURN(config);
 
@@ -236,11 +237,28 @@ config_save(Config *config)
    snprintf(buf, sizeof(buf), "%s/terminology/config/standard/base.cfg.tmp", 
cfgdir);
    snprintf(buf2, sizeof(buf2), "%s/terminology/config/standard/base.cfg", 
cfgdir);
    ef = eet_open(buf, EET_FILE_MODE_WRITE);
-   if (ef)
+   if (!ef)
+     {
+        ERR("error opening file '%s' for writing", buf);
+        return;
+     }
+   ok = eet_data_write(ef, edd_base, CONFIG_KEY, config, 1);
+   if (!ok)
      {
-        ok = eet_data_write(ef, edd_base, CONFIG_KEY, config, 1);
         eet_close(ef);
-        if (ok) ecore_file_mv(buf, buf2);
+        ERR("error writing to file '%s'", buf);
+        return;
+     }
+   err = eet_close(ef);
+   if (err != EET_ERROR_NONE)
+     {
+        ERR("error #%d closing file '%s'", err, buf);
+        return;
+     }
+   if (!ecore_file_mv(buf, buf2))
+     {
+        ERR("error moving file '%s' to '%s'", buf, buf2);
+        return;
      }
    main_config_sync(config);
 }

-- 


Reply via email to