forked from enlightenment/efl
eina: Replace remove with rmdir and delete tmpstr
Although the [remove manpage](https://linux.die.net/man/3/remove) states that `remove(...)` deletes either a file or a directory, this is not true in Windows as it can be seen in [MSDN docs for remove](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/remove-wremove?view=vs-2019): > **(Function description)** > > Delete a file. > > **Return Value** > > Each of these functions returns 0 if the file is successfully deleted. > Otherwise, **it returns -1 and sets errno either to EACCES to indicate that the > path** specifies a read-only file, //**specifies a directory**//, or the file > is open, or to ENOENT to indicate that the filename or path was not found. This implementation detail caused the Eina test to fail and not removing the temporary directory. This patch changes the use of `remove` to the directory-specific `rmdir`, which is guaranteed to remove the directory. Additionally, it also deletes the Eina_TmpStr that holds the temporary directory path. Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12115
This commit is contained in:
parent
07d6a25c20
commit
abc308accb
|
@ -849,7 +849,8 @@ EFL_START_TEST(eina_test_file_mktemp)
|
|||
eina_iterator_free(it);
|
||||
|
||||
fail_if(unlink(tmpfile));
|
||||
fail_if(remove(tmpdir));
|
||||
fail_if(rmdir(tmpdir));
|
||||
eina_tmpstr_del(tmpdir);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
|
|
Loading…
Reference in New Issue