From 7f0848648b64108f1386a1340f68c50d0f8b2b94 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 29 Apr 2019 19:11:56 +0000 Subject: [PATCH] MFC r346539: Fix `get_int_via_sysctlbyname(..)` on Jenkins Initialize `oldlen` to the size of the value, instead of leaving the value unitialized. Leaving it unitialized seems to work by accident on amd64 when running 64-bit programs, but not on i386. This matches patterns in use in other programs. PR: 237458 Tested on: ^/head (amd64), ^/stable/11 (i386) --- lib/libc/tests/sys/sendfile_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c index e7eddfde928..fceabc3ed2d 100644 --- a/lib/libc/tests/sys/sendfile_test.c +++ b/lib/libc/tests/sys/sendfile_test.c @@ -62,6 +62,8 @@ get_int_via_sysctlbyname(const char *oidname) size_t oldlen; int int_value; + oldlen = sizeof(int_value); + ATF_REQUIRE_EQ_MSG(sysctlbyname(oidname, &int_value, &oldlen, NULL, 0), 0, "sysctlbyname(%s, ...) failed: %s", oidname, strerror(errno)); ATF_REQUIRE_EQ_MSG(sizeof(int_value), oldlen, "sanity check failed"); -- 2.45.0