svn commit: r300384 - head/sys/compat/ndis

Pedro F. Giffuni pfg at FreeBSD.org
Sun May 22 00:29:27 UTC 2016


Author: pfg
Date: Sun May 22 00:29:25 2016
New Revision: 300384
URL: https://svnweb.freebsd.org/changeset/base/300384

Log:
  ndis(4):  adjustments for our random() specific implementation.
  
  - Revert r300377: The implementation claims to return a value
    within the range. [1]
  - Adjust the value for the case of a zero seed, whihc according
    to standards should be equivalent to a seed of value 1.
  
  Pointed out by:	cem

Modified:
  head/sys/compat/ndis/subr_ntoskrnl.c

Modified: head/sys/compat/ndis/subr_ntoskrnl.c
==============================================================================
--- head/sys/compat/ndis/subr_ntoskrnl.c	Sat May 21 23:21:42 2016	(r300383)
+++ head/sys/compat/ndis/subr_ntoskrnl.c	Sun May 22 00:29:25 2016	(r300384)
@@ -3189,13 +3189,15 @@ static int
 rand(void)
 {
 
-	return (random() / 2 + 1);
+	return (random());
 }
 
 static void
 srand(unsigned int seed)
 {
 
+	if (seed == 0)
+		seed = 1;
 	srandom(seed);
 }
 


More information about the svn-src-head mailing list