Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 02:27:59 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273021 - head/contrib/netbsd-tests/lib/libc/string
Message-ID:  <201410130227.s9D2RxSb033529@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Oct 13 02:27:59 2014
New Revision: 273021
URL: https://svnweb.freebsd.org/changeset/base/273021

Log:
  Use 1 as a random seed, as recommended in srandom(3). Adjust the random values
  accordingly
  
  Submitted by: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/string/t_memcpy.c

Modified: head/contrib/netbsd-tests/lib/libc/string/t_memcpy.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/string/t_memcpy.c	Mon Oct 13 02:23:24 2014	(r273020)
+++ head/contrib/netbsd-tests/lib/libc/string/t_memcpy.c	Mon Oct 13 02:27:59 2014	(r273021)
@@ -51,7 +51,11 @@ unsigned char *start[BLOCKTYPES] = {
 };
 
 char result[100];
+#if defined(__NetBSD__)
 const char goodResult[] = "7b405d24bc03195474c70ddae9e1f8fb";
+#else
+const char goodResult[] = "217b4fbe456916bf62a2f85df752e4ab";
+#endif
 
 static void
 runTest(unsigned char *b1, unsigned char *b2)
@@ -89,7 +93,15 @@ ATF_TC_BODY(memcpy_basic, tc)
 	start[2] = auto1;
 	start[3] = auto2;
 
+#if defined(__NetBSD__)
 	srandom(0L);
+#else
+	/*
+	 * random() shall produce by default a sequence of numbers that can be
+	 * duplicated by calling srandom() with 1 as the seed.
+	 */
+	srandom(1);
+#endif
 	MD5Init(mc);
 	for (i = 0; i < BLOCKTYPES; ++i)
 		for (j = 0; j < BLOCKTYPES; ++j)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410130227.s9D2RxSb033529>