elm/code: check save file attrs after opening

ensure that they haven't changed between time of check and time of open

CID 1396966

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10440
This commit is contained in:
Mike Blumenkrantz 2019-10-17 10:23:34 -04:00 committed by Cedric BAIL
parent b2ee3ad748
commit cdacc790f7
1 changed files with 5 additions and 6 deletions

View File

@ -185,18 +185,17 @@ EAPI void elm_code_file_save(Elm_Code_File *file)
tmp = _elm_code_file_tmp_path_get(file);
crchars = elm_code_file_line_ending_chars_get(file, &crlength);
if (stat(path, &st) != -1)
{
mode = st.st_mode;
have_mode = EINA_TRUE;
}
out = fopen(tmp, "w");
if (out == NULL)
{
free(tmp);
return;
}
if (fstat(fileno(out), &st) != -1)
{
mode = st.st_mode;
have_mode = EINA_TRUE;
}
EINA_LIST_FOREACH(file->lines, item, line_item)
{