elm_config: replace ecore_file_cp with ecore_file_mv 52/216152/1 submit/tizen/20191021.124352
authorWonki Kim <wonki_.kim@samsung.com>
Mon, 21 Oct 2019 11:10:02 +0000 (20:10 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 21 Oct 2019 11:10:02 +0000 (20:10 +0900)
ecore_file_cp can cause elm_config eet data invalid.
this patch replaces it with ecore_file_mv to prevent the problem.

Change-Id: I5e39ab88cf5ecb70e9d9823b43ebdcc92b2cfc51
Signed-off-by: Wonki Kim <wonki_.kim@samsung.com>
src/lib/elementary/elm_config.c

index ac7b86b..4f0eb68 100644 (file)
@@ -907,9 +907,11 @@ _elm_config_profile_derived_save(const char *profile, Elm_Config_Derived *derive
         eet_close(ef);
         if (ret)
           {
-             if (!ecore_file_cp(buf, buf2))
-               ERR("Error saving Elementary's derived configuration profile file");
-             ecore_file_unlink(buf);
+             if (!ecore_file_mv(buf, buf2))
+               {
+                  ERR("Error saving Elementary's derived configuration profile file");
+                  ecore_file_unlink(buf);
+               }
           }
         else
           {
@@ -2405,15 +2407,13 @@ _elm_config_profile_save(const char *profile)
         goto err;
      }
 
-   ret = ecore_file_cp(buf2, buf);
+   ret = ecore_file_mv(buf2, buf);
    if (!ret)
      {
         ERR("Error saving Elementary's configuration profile file");
         goto err;
      }
 
-   ecore_file_unlink(buf2);
-
    derived = _elm_config_derived_load(profile ? profile : _elm_profile);
    if (derived)
      {
@@ -2524,14 +2524,13 @@ _elm_config_save_internal(Elm_Config *cfg, const char *profile, Elm_Config_Snpri
         goto err;
      }
 
-   ret = ecore_file_cp(buf2, buf);
+   ret = ecore_file_mv(buf2, buf);
    if (!ret)
      {
         ERR("Error saving Elementary's configuration file");
         goto err;
      }
 
-   ecore_file_unlink(buf2);
    return EINA_TRUE;
 
 err: