From be5b6b24768d95eceb5749711e5034b7d65dd547 Mon Sep 17 00:00:00 2001 From: Wander Lairson Costa Date: Fri, 12 Jun 2020 20:27:51 +0000 Subject: [PATCH] eina_test_file.c: Do not test errno if the function doesn't fail errno only holds a valid value if the function returns an error. ref: windows-native-port Reviewed-by: Stefan Schmidt Differential Revision: https://phab.enlightenment.org/D11971 --- src/tests/eina/eina_test_file.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c index ccd6e55ca5..0ed1c93d75 100644 --- a/src/tests/eina/eina_test_file.c +++ b/src/tests/eina/eina_test_file.c @@ -746,15 +746,13 @@ EFL_START_TEST(eina_test_file_mktemp) "./eina_file_test_XXXXXX.txt", }; - errno = 0; - /* test NULL */ EXPECT_ERROR_START; fd = eina_file_mkstemp(NULL, NULL); fail_if(fd >= 0); EXPECT_ERROR_END; fd = eina_file_mkstemp(patterns[0], NULL); - fail_if((fd < 0) || errno); + fail_if(fd < 0); /* here's an attempt at removing the file, without knowing its path */ #ifdef F_GETPATH @@ -783,12 +781,10 @@ EFL_START_TEST(eina_test_file_mktemp) for (unsigned int k = 0; k < sizeof(patterns) / sizeof(patterns[0]); k++) { - errno = 0; tmpfile = NULL; fd = eina_file_mkstemp(patterns[k], &tmpfile); ck_assert(fd >= 0); ck_assert(!!tmpfile); - ck_assert_msg(!errno, "ERROR(%s): %s\n", patterns[k], strerror(errno)); file = eina_file_open(tmpfile, EINA_FALSE); fail_if(!file); eina_file_close(file); @@ -813,7 +809,7 @@ EFL_START_TEST(eina_test_file_mktemp) eina_file_path_join(buf, sizeof(buf), tmpdir, "eina_file_test_XXXXXX.txt"); fd = eina_file_mkstemp(buf, &tmpfile); - fail_if((fd < 0) || !tmpfile || errno); + fail_if((fd < 0) || !tmpfile); fail_if(close(fd)); it = eina_file_direct_ls(tmpdir);