From 82caa21c0590a8f6f50805e7d7fe042e776a443a Mon Sep 17 00:00:00 2001 From: ngie Date: Tue, 18 Jul 2017 18:51:34 +0000 Subject: MFC r319063: Send all of `data`, not just a portion of it It was sending only a long's worth (4 or 8 bytes) of data previously (instead of the entire buffer) via send(2). CID: 1229966, 1229967, 1230004, 1230005 --- tests/sys/kern/unix_seqpacket_test.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/sys') diff --git a/tests/sys/kern/unix_seqpacket_test.c b/tests/sys/kern/unix_seqpacket_test.c index 3499b894..6d50816 100644 --- a/tests/sys/kern/unix_seqpacket_test.c +++ b/tests/sys/kern/unix_seqpacket_test.c @@ -762,7 +762,7 @@ ATF_TC_BODY(shutdown_send, tc) /* ATF's isolation mechanisms will guarantee uniqueness of this file */ const char *path = "sock"; const char *data = "data"; - ssize_t ssize; + ssize_t datalen, ssize; int s, err, s2; s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); @@ -786,8 +786,9 @@ ATF_TC_BODY(shutdown_send, tc) } ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR)); + datalen = strlen(data) + 1; /* +1 for the null */ /* USE MSG_NOSIGNAL so we don't get SIGPIPE */ - ssize = send(s2, data, sizeof(data), MSG_EOR | MSG_NOSIGNAL); + ssize = send(s2, data, datalen, MSG_EOR | MSG_NOSIGNAL); ATF_CHECK_EQ(EPIPE, errno); ATF_CHECK_EQ(-1, ssize); close(s); @@ -802,6 +803,7 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc) /* ATF's isolation mechanisms will guarantee uniqueness of this file */ const char *path = "sock"; const char *data = "data"; + ssize_t datalen; int s, err, s2; s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); @@ -826,7 +828,8 @@ ATF_TC_BODY(shutdown_send_sigpipe, tc) ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR)); ATF_REQUIRE(SIG_ERR != signal(SIGPIPE, shutdown_send_sigpipe_handler)); - (void)send(s2, data, sizeof(data), MSG_EOR); + datalen = strlen(data) + 1; /* +1 for the null */ + (void)send(s2, data, sizeof(*data), MSG_EOR); ATF_CHECK_EQ(1, got_sigpipe); close(s); close(s2); -- cgit v1.1