From b9c52b50a7ceb5bb43399df3b224e41e28019277 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sun, 22 May 2016 00:29:25 +0000 Subject: [PATCH] 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 --- sys/compat/ndis/subr_ntoskrnl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index 35f38a46387..9b5e40344f8 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -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); }