forked from enlightenment/efl
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
This commit is contained in:
parent
1842d3997a
commit
d0288f4730
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue