git: d643925a79ca - main - unix tests: Use the right type for sendmsg(2) return values

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 16 Sep 2023 09:33:19 UTC
The branch main has been updated by markj:

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

commit d643925a79caab5c6de62b066e374935b60bcaf1
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-09-15 08:59:08 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-15 17:04:15 +0000

    unix tests: Use the right type for sendmsg(2) return values
    
    MFC after:      1 week
---
 tests/sys/kern/unix_passfd_test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c
index 94f0c420029a..d8c0efe5b9ea 100644
--- a/tests/sys/kern/unix_passfd_test.c
+++ b/tests/sys/kern/unix_passfd_test.c
@@ -182,13 +182,13 @@ sendfd_payload(int sockfd, int send_fd, void *payload, size_t paylen)
 static void
 sendfd(int sockfd, int send_fd)
 {
-	size_t len;
+	ssize_t len;
 	char ch;
 
 	ch = 0;
 	len = sendfd_payload(sockfd, send_fd, &ch, sizeof(ch));
 	ATF_REQUIRE_MSG(len == sizeof(ch),
-	    "sendmsg: %zu bytes sent; expected %zu; %s", len, sizeof(ch),
+	    "sendmsg: %zd bytes sent; expected %zu; %s", len, sizeof(ch),
 	    strerror(errno));
 }
 
@@ -532,10 +532,10 @@ ATF_TC_BODY(send_overflow, tc)
 	len = sendfd_payload(fd[0], putfd, buf, sendspace);
 #if TEST_PROTO == SOCK_STREAM
 	ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN,
-	    "sendmsg: %zu bytes sent, errno %d", len, errno);
+	    "sendmsg: %zd bytes sent, errno %d", len, errno);
 #elif TEST_PROTO == SOCK_DGRAM
 	ATF_REQUIRE_MSG(len == -1 && errno == ENOBUFS,
-	    "sendmsg: %zu bytes sent, errno %d", len, errno);
+	    "sendmsg: %zd bytes sent, errno %d", len, errno);
 #endif
 	close(putfd);
 	ATF_REQUIRE(nfiles == openfiles());
@@ -655,14 +655,14 @@ ATF_TC_BODY(rights_creds_payload, tc)
 #if TEST_PROTO == SOCK_STREAM
 	ATF_REQUIRE_MSG(len != -1 , "sendmsg failed: %s", strerror(errno));
 	ATF_REQUIRE_MSG((size_t)len < sendspace,
-	    "sendmsg: %zu bytes sent", len);
+	    "sendmsg: %zd bytes sent", len);
 	recvfd_payload(fd[1], &getfd, buf, len,
 	    CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0);
 #endif
 #if TEST_PROTO == SOCK_DGRAM
 	ATF_REQUIRE_MSG(len != -1 , "sendmsg failed: %s", strerror(errno));
 	ATF_REQUIRE_MSG((size_t)len == sendspace,
-	    "sendmsg: %zu bytes sent", len);
+	    "sendmsg: %zd bytes sent", len);
 	recvfd_payload(fd[1], &getfd, buf, len,
 	    CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0);
 #endif