summaryrefslogtreecommitdiffstats
path: root/tests/sys
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-07-18 18:51:34 +0000
committerngie <ngie@FreeBSD.org>2017-07-18 18:51:34 +0000
commit82caa21c0590a8f6f50805e7d7fe042e776a443a (patch)
tree894687925cf2c5ff865986d56ebfa13e9b559141 /tests/sys
parent433a1b7fb95c2344b556abecd9bfce98766877b2 (diff)
downloadFreeBSD-src-82caa21c0590a8f6f50805e7d7fe042e776a443a.zip
FreeBSD-src-82caa21c0590a8f6f50805e7d7fe042e776a443a.tar.gz
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
Diffstat (limited to 'tests/sys')
-rw-r--r--tests/sys/kern/unix_seqpacket_test.c9
1 files changed, 6 insertions, 3 deletions
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);
OpenPOWER on IntegriCloud