summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Michael <devilhorns@comcast.net>2021-02-24 08:00:13 -0500
committerChristopher Michael <devilhorns@comcast.net>2021-02-24 08:00:13 -0500
commitd0288f4730451a2c6813a7bd1a133e09cd600994 (patch)
treecde80d82ee203dfa9ce0cb0db5af2006b66ee5b6 /src
parent1842d3997a88e22421eddeed49be50a0db08b7ce (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/tests/eina/eina_test_file.c4
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)
357 strcat(test_file2_path, test_file2_name_part); 357 strcat(test_file2_path, test_file2_name_part);
358 358
359 fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 359 fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
360 fail_if(fd == 0); 360 fail_if(fd <= 0);
361 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string)); 361 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
362 close(fd); 362 close(fd);
363 363
364 fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 364 fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
365 fail_if(fd == 0); 365 fail_if(fd <= 0);
366 fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset); 366 fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset);
367 close(fd); 367 close(fd);
368 368