Module Name: src
Committed By: christos
Date: Sat Mar 16 21:46:43 UTC 2019
Modified Files:
src/tests/lib/libc/sys: t_sendmmsg.c
Log Message:
PR/54062: Using random garbage in the mmsghdr (in this case 0xa5's from
jemalloc debug) makes the syscall unhappy. Zero out the memory instead...
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_sendmmsg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/sys/t_sendmmsg.c
diff -u src/tests/lib/libc/sys/t_sendmmsg.c:1.2 src/tests/lib/libc/sys/t_sendmmsg.c:1.3
--- src/tests/lib/libc/sys/t_sendmmsg.c:1.2 Tue Oct 16 05:23:29 2018
+++ src/tests/lib/libc/sys/t_sendmmsg.c Sat Mar 16 17:46:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sendmmsg.c,v 1.2 2018/10/16 09:23:29 roy Exp $ */
+/* $NetBSD: t_sendmmsg.c,v 1.3 2019/03/16 21:46:43 christos Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sendmmsg.c,v 1.2 2018/10/16 09:23:29 roy Exp $");
+__RCSID("$NetBSD: t_sendmmsg.c,v 1.3 2019/03/16 21:46:43 christos Exp $");
#include <atf-c.h>
#include <sys/types.h>
@@ -101,7 +101,7 @@ ATF_TC_BODY(sendmmsg_basic, tc)
// setsock(fd[0], SO_RCVBUF);
mmsgcnt = BUFSIZE / sizeof(DGRAM);
- mmsghdr = malloc(sizeof(*mmsghdr) * mmsgcnt);
+ mmsghdr = calloc(mmsgcnt, sizeof(*mmsghdr));
ATF_REQUIRE_MSG(mmsghdr != NULL, "malloc failed (%s)", strerror(errno));
iov = malloc(sizeof(*iov) * mmsgcnt);
ATF_REQUIRE_MSG(iov != NULL, "malloc failed (%s)", strerror(errno));
@@ -162,8 +162,8 @@ ATF_TC_BODY(sendmmsg_basic, tc)
sched_yield();
continue;
}
- ATF_REQUIRE_MSG(cnt != -1, "sendmmsg failed (%s)",
- strerror(errno));
+ ATF_REQUIRE_MSG(cnt != -1, "sendmmsg %u failed (%s)",
+ n, strerror(errno));
if (debug)
printf("sendmmsg: sent %u messages\n", cnt);
n += cnt;