]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__srandom_r): Don't use seed 0. Use 1 in this case.
authorUlrich Drepper <drepper@redhat.com>
Sat, 23 Aug 1997 21:51:19 +0000 (21:51 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 23 Aug 1997 21:51:19 +0000 (21:51 +0000)
stdlib/random_r.c

index 58f5153936a8ece3d4111325b3d2ca5a36211b35..6355097a936fbb7f20c56615447b3719486425de 100644 (file)
@@ -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;