libgit2 tries to close an invalid file descriptor when using OpenSSH
Reproduction steps
The automatic tests generates this behavior for:
Linux (Xenial, GCC, mbedTLS, OpenSSH)
Linux (Xenial, Clang, OpenSSL, OpenSSH)
https://github.com/libgit2/libgit2/actions/runs/7215018549/job/19658420551
8: ==9753== Command: /home/libgit2/build/libgit2_tests -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh -sonline::clone::ssh_auth_methods
8: ==9753== Warning: invalid file descriptor -1 in syscall close()
Expected behavior
I would expect it not not close invalid file descriptors.
Actual behavior
It tries to close invalid file descriptors.
Version of libgit2 (release number or SHA1)
b4e84a7
Operating system(s) tested
Linux (Xenial, GCC, mbedTLS, OpenSSH)
Linux (Xenial, Clang, OpenSSL, OpenSSH)