git: 694c708d6a0d - main - ktls tests: Check the return values of close().

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 16 Nov 2021 17:56:28 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=694c708d6a0d00f84fa53357a1cc8a72272a26e3

commit 694c708d6a0d00f84fa53357a1cc8a72272a26e3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-11-16 17:56:15 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-11-16 17:56:15 +0000

    ktls tests: Check the return values of close().
    
    Suggested by:   markj
    Reviewed by:    markj
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D33004
---
 tests/sys/kern/ktls_test.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c
index 64e26bb27f37..9942e78091b1 100644
--- a/tests/sys/kern/ktls_test.c
+++ b/tests/sys/kern/ktls_test.c
@@ -945,9 +945,9 @@ test_ktls_transmit_app_data(struct tls_enable *en, uint64_t seqno, size_t len)
 	free(decrypted);
 	free(plaintext);
 
-	close(sockets[1]);
-	close(sockets[0]);
-	close(kq);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
+	ATF_REQUIRE(close(kq) == 0);
 }
 
 static void
@@ -1031,8 +1031,8 @@ test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type,
 	free(decrypted);
 	free(plaintext);
 
-	close(sockets[1]);
-	close(sockets[0]);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
 }
 
 static void
@@ -1083,8 +1083,8 @@ test_ktls_transmit_empty_fragment(struct tls_enable *en, uint64_t seqno)
 
 	free(outbuf);
 
-	close(sockets[1]);
-	close(sockets[0]);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
 }
 
 static size_t
@@ -1218,9 +1218,9 @@ test_ktls_receive_app_data(struct tls_enable *en, uint64_t seqno, size_t len)
 	free(received);
 	free(plaintext);
 
-	close(sockets[1]);
-	close(sockets[0]);
-	close(kq);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
+	ATF_REQUIRE(close(kq) == 0);
 }
 
 #define	TLS_10_TESTS(M)							\
@@ -1474,8 +1474,8 @@ test_ktls_invalid_transmit_cipher_suite(struct tls_enable *en)
 	    sizeof(*en)) == -1);
 	ATF_REQUIRE(errno == EINVAL);
 
-	close(sockets[1]);
-	close(sockets[0]);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
 }
 
 #define GEN_INVALID_TRANSMIT_TEST(name, cipher_alg, key_size, auth_alg,	\
@@ -1591,8 +1591,8 @@ test_ktls_invalid_receive_cipher_suite(struct tls_enable *en)
 	 */
 	ATF_REQUIRE(errno == EINVAL || errno == ENOTSUP);
 
-	close(sockets[1]);
-	close(sockets[0]);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
 }
 
 #define GEN_INVALID_RECEIVE_TEST(name, cipher_alg, key_size, auth_alg,	\
@@ -1631,8 +1631,8 @@ test_ktls_unsupported_receive_cipher_suite(struct tls_enable *en)
 	    sizeof(*en)) == -1);
 	ATF_REQUIRE(errno == EPROTONOSUPPORT || errno == ENOTSUP);
 
-	close(sockets[1]);
-	close(sockets[0]);
+	ATF_REQUIRE(close(sockets[1]) == 0);
+	ATF_REQUIRE(close(sockets[0]) == 0);
 }
 
 #define GEN_UNSUPPORTED_RECEIVE_TEST(name, cipher_alg, key_size,	\