forked from enlightenment/efl
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:
parent
5e3db3bef8
commit
5778274021
|
@ -185,18 +185,17 @@ EAPI void elm_code_file_save(Elm_Code_File *file)
|
||||||
tmp = _elm_code_file_tmp_path_get(file);
|
tmp = _elm_code_file_tmp_path_get(file);
|
||||||
crchars = elm_code_file_line_ending_chars_get(file, &crlength);
|
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");
|
out = fopen(tmp, "w");
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
{
|
{
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (fstat(fileno(out), &st) != -1)
|
||||||
|
{
|
||||||
|
mode = st.st_mode;
|
||||||
|
have_mode = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(file->lines, item, line_item)
|
EINA_LIST_FOREACH(file->lines, item, line_item)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue