From d0288f4730451a2c6813a7bd1a133e09cd600994 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 24 Feb 2021 08:00:13 -0500 Subject: [PATCH] eina_tests: Fix argument cannot be negative Coverity reports that 'fd' returned from 'open' here returns a negative number. Passing a negative number to the 'write' function is not allowed, so we should change the 'fail_if' checks here to make sure 'fd' is not negative. Fixes CID1400940 @fix --- src/tests/eina/eina_test_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c index 3d4412bfa2..3e12206094 100644 --- a/src/tests/eina/eina_test_file.c +++ b/src/tests/eina/eina_test_file.c @@ -357,12 +357,12 @@ EFL_START_TEST(eina_file_map_new_test) strcat(test_file2_path, test_file2_name_part); fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); - fail_if(fd == 0); + fail_if(fd <= 0); fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string)); close(fd); fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); - fail_if(fd == 0); + fail_if(fd <= 0); fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset); close(fd);