summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2013-07-04 00:02:10 +0000
committerache <ache@FreeBSD.org>2013-07-04 00:02:10 +0000
commit6c9946f64c70a0b3d7b6e4a99876a37c62f87efd (patch)
treeee76cc7ff6555da8ae0252bef97f9d1c8ee35ff9
parentd57fff39870254b2d8d537f69ae5ebc1142ab6df (diff)
downloadFreeBSD-src-6c9946f64c70a0b3d7b6e4a99876a37c62f87efd.zip
FreeBSD-src-6c9946f64c70a0b3d7b6e4a99876a37c62f87efd.tar.gz
After fixing ranges restore POSIX requirement: rand() call without
srand() must be the same as srand(1); rand(); (yet one increment)
-rw-r--r--lib/libc/stdlib/rand.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c
index 58b3753..270e63f 100644
--- a/lib/libc/stdlib/rand.c
+++ b/lib/libc/stdlib/rand.c
@@ -99,7 +99,12 @@ rand_r(unsigned int *ctx)
}
-static u_long next = 1;
+static u_long next =
+#ifdef USE_WEAK_SEEDING
+ 1;
+#else
+ 2;
+#endif
int
rand()
OpenPOWER on IntegriCloud