summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Lairson Costa <wander.lairson@gmail.com>2020-06-12 20:27:51 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2020-06-23 14:03:28 +0200
commitbe5b6b24768d95eceb5749711e5034b7d65dd547 (patch)
tree82d13eb691a3a815d6ed7e5cd1ec4219a525e63a
parente137478dc5b01f77c281cc2efbc0f96f32824307 (diff)
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 <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11971
-rw-r--r--src/tests/eina/eina_test_file.c8
1 files 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)
746 "./eina_file_test_XXXXXX.txt", 746 "./eina_file_test_XXXXXX.txt",
747 }; 747 };
748 748
749 errno = 0;
750
751 /* test NULL */ 749 /* test NULL */
752 EXPECT_ERROR_START; 750 EXPECT_ERROR_START;
753 fd = eina_file_mkstemp(NULL, NULL); 751 fd = eina_file_mkstemp(NULL, NULL);
754 fail_if(fd >= 0); 752 fail_if(fd >= 0);
755 EXPECT_ERROR_END; 753 EXPECT_ERROR_END;
756 fd = eina_file_mkstemp(patterns[0], NULL); 754 fd = eina_file_mkstemp(patterns[0], NULL);
757 fail_if((fd < 0) || errno); 755 fail_if(fd < 0);
758 756
759 /* here's an attempt at removing the file, without knowing its path */ 757 /* here's an attempt at removing the file, without knowing its path */
760#ifdef F_GETPATH 758#ifdef F_GETPATH
@@ -783,12 +781,10 @@ EFL_START_TEST(eina_test_file_mktemp)
783 781
784 for (unsigned int k = 0; k < sizeof(patterns) / sizeof(patterns[0]); k++) 782 for (unsigned int k = 0; k < sizeof(patterns) / sizeof(patterns[0]); k++)
785 { 783 {
786 errno = 0;
787 tmpfile = NULL; 784 tmpfile = NULL;
788 fd = eina_file_mkstemp(patterns[k], &tmpfile); 785 fd = eina_file_mkstemp(patterns[k], &tmpfile);
789 ck_assert(fd >= 0); 786 ck_assert(fd >= 0);
790 ck_assert(!!tmpfile); 787 ck_assert(!!tmpfile);
791 ck_assert_msg(!errno, "ERROR(%s): %s\n", patterns[k], strerror(errno));
792 file = eina_file_open(tmpfile, EINA_FALSE); 788 file = eina_file_open(tmpfile, EINA_FALSE);
793 fail_if(!file); 789 fail_if(!file);
794 eina_file_close(file); 790 eina_file_close(file);
@@ -813,7 +809,7 @@ EFL_START_TEST(eina_test_file_mktemp)
813 eina_file_path_join(buf, sizeof(buf), tmpdir, "eina_file_test_XXXXXX.txt"); 809 eina_file_path_join(buf, sizeof(buf), tmpdir, "eina_file_test_XXXXXX.txt");
814 810
815 fd = eina_file_mkstemp(buf, &tmpfile); 811 fd = eina_file_mkstemp(buf, &tmpfile);
816 fail_if((fd < 0) || !tmpfile || errno); 812 fail_if((fd < 0) || !tmpfile);
817 fail_if(close(fd)); 813 fail_if(close(fd));
818 814
819 it = eina_file_direct_ls(tmpdir); 815 it = eina_file_direct_ls(tmpdir);