elm_config: replace ecore_file_cp with ecore_file_mv

ecore_file_cp can cause config data(eet file) invalid,
once multiple processes are trying to call elm_config_save.

this patch replaces it with ecore_file_mv to prevent the problem.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10578
This commit is contained in:
Wonki Kim 2019-11-04 01:43:34 +00:00 committed by Cedric BAIL
parent 249ffd6a50
commit da5c0c63f2
1 changed files with 7 additions and 8 deletions

View File

@ -809,9 +809,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
{
@ -2155,15 +2157,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)
{
@ -2248,14 +2248,13 @@ _elm_config_save(Elm_Config *cfg, 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 file");
goto err;
}
ecore_file_unlink(buf2);
return EINA_TRUE;
err: