From: Daniel Salzman Date: Sun, 29 Jun 2025 18:55:21 +0000 (+0200) Subject: libknot: avoid calling close(-1) (Coverity) X-Git-Tag: v3.5.0~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a7d0fd9ca7f06cced1b303d2d18afec36f42f01;p=thirdparty%2Fknot-dns.git libknot: avoid calling close(-1) (Coverity) --- diff --git a/src/libknot/quic/tls_common.c b/src/libknot/quic/tls_common.c index 65cab40cc7..4277414fdf 100644 --- a/src/libknot/quic/tls_common.c +++ b/src/libknot/quic/tls_common.c @@ -284,7 +284,9 @@ static void hash_file(SIPHASH_CTX *ctx, const char *file_name) if (fd == -1 || fstat(fd, &file_stat) == -1 || (data = mmap(0, file_stat.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { - close(fd); + if (fd > -1) { + close(fd); + } return; }