svn commit: r346539 - head/lib/libc/tests/sys

Enji Cooper ngie at FreeBSD.org
Tue Sep 3 14:07:39 UTC 2019


Author: ngie
Date: Mon Apr 22 11:09:24 2019
New Revision: 346539
URL: https://svnweb.freebsd.org/changeset/base/346539

Log:
  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
  Approved by:	emaste (mentor; implicit)
  MFC after:	1 week
  Tested on:	^/head (amd64), ^/stable/11 (i386)

Modified:
  head/lib/libc/tests/sys/sendfile_test.c

Modified: head/lib/libc/tests/sys/sendfile_test.c
==============================================================================
--- head/lib/libc/tests/sys/sendfile_test.c	Mon Apr 22 10:02:34 2019	(r346538)
+++ head/lib/libc/tests/sys/sendfile_test.c	Mon Apr 22 11:09:24 2019	(r346539)
@@ -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");




More information about the svn-src-head mailing list