Skip to content

Commit

Permalink
tests/test-read: call close(2) only if there is an fd
Browse files Browse the repository at this point in the history
Fixes: Coverity 382190
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
  • Loading branch information
mihalicyn committed Jan 31, 2025
1 parent 19e2c99 commit a43c87d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test-read.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int main(int argc, char *argv[]){
sleep(1);
}
printf("======read sum: %d======\n", sum);
close(fd);
if (fd >= 0)
close(fd);
return 0;
}

0 comments on commit a43c87d

Please sign in to comment.