summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-08-24 16:52:43 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2020-08-31 11:16:43 +0200
commitabc308accb39dc6f7e946108da1b5a65489bc051 (patch)
tree32015313e7cf83e563ff484eee82a6cf8e6e989a
parent07d6a25c2060487014f3dcb19271935114af588a (diff)
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
-rw-r--r--src/tests/eina/eina_test_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 8a9b13e29c..f8771896ef 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -849,7 +849,8 @@ EFL_START_TEST(eina_test_file_mktemp)
849 eina_iterator_free(it); 849 eina_iterator_free(it);
850 850
851 fail_if(unlink(tmpfile)); 851 fail_if(unlink(tmpfile));
852 fail_if(remove(tmpdir)); 852 fail_if(rmdir(tmpdir));
853 eina_tmpstr_del(tmpdir);
853} 854}
854EFL_END_TEST 855EFL_END_TEST
855 856