diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-08-23 21:51:19 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-08-23 21:51:19 +0000 |
commit | 944599f7c3fc2e867452a39ce0e3ae01159c477d (patch) | |
tree | 99a61b61462fdb89ad548603d37fe33891f800f0 | |
parent | a0fcfbc60894bfd533491c4043e8129ddbf6c94e (diff) | |
download | glibc-944599f7c3fc2e867452a39ce0e3ae01159c477d.zip glibc-944599f7c3fc2e867452a39ce0e3ae01159c477d.tar.gz glibc-944599f7c3fc2e867452a39ce0e3ae01159c477d.tar.bz2 |
(__srandom_r): Don't use seed 0. Use 1 in this case.
-rw-r--r-- | stdlib/random_r.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/random_r.c b/stdlib/random_r.c index 58f5153..6355097 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; |