stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=abc308accb39dc6f7e946108da1b5a65489bc051

commit abc308accb39dc6f7e946108da1b5a65489bc051
Author: João Paulo Taylor Ienczak Zanette <jpaulo...@gmail.com>
Date:   Mon Aug 24 16:52:43 2020 +0000

    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.to...@gmail.com>
    Reviewed-by: Stefan Schmidt <ste...@datenfreihafen.org>
    Differential Revision: https://phab.enlightenment.org/D12115
---
 src/tests/eina/eina_test_file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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)
    eina_iterator_free(it);
 
    fail_if(unlink(tmpfile));
-   fail_if(remove(tmpdir));
+   fail_if(rmdir(tmpdir));
+   eina_tmpstr_del(tmpdir);
 }
 EFL_END_TEST
 

-- 


Reply via email to