From 944599f7c3fc2e867452a39ce0e3ae01159c477d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 23 Aug 1997 21:51:19 +0000 Subject: [PATCH] (__srandom_r): Don't use seed 0. Use 1 in this case. --- stdlib/random_r.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/random_r.c b/stdlib/random_r.c index 58f5153936a..6355097a936 100644 --- a/stdlib/random_r.c +++ b/stdlib/random_r.c @@ -127,7 +127,8 @@ __srandom_r (x, buf) if (buf == NULL || buf->rand_type < TYPE_0 || buf->rand_type > TYPE_4) return -1; - buf->state[0] = x; + /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */ + buf->state[0] = x ? x : 1; if (buf->rand_type != TYPE_0) { long int i; -- 2.47.2