diff options
author | Christopher Michael <devilhorns@comcast.net> | 2021-02-24 08:00:13 -0500 |
---|---|---|
committer | Christopher Michael <devilhorns@comcast.net> | 2021-02-24 08:00:13 -0500 |
commit | d0288f4730451a2c6813a7bd1a133e09cd600994 (patch) | |
tree | cde80d82ee203dfa9ce0cb0db5af2006b66ee5b6 | |
parent | 1842d3997a88e22421eddeed49be50a0db08b7ce (diff) | |
download | efl-d0288f4730451a2c6813a7bd1a133e09cd600994.tar.gz |
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
-rw-r--r-- | src/tests/eina/eina_test_file.c | 4 |
1 files 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); |