diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/lcong48_r.c | 1 | ||||
-rw-r--r-- | stdlib/random_r.c | 3 | ||||
-rw-r--r-- | stdlib/seed48_r.c | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/stdlib/lcong48_r.c b/stdlib/lcong48_r.c index c7baa3815f..ac30d7941a 100644 --- a/stdlib/lcong48_r.c +++ b/stdlib/lcong48_r.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <string.h> +#include <limits.h> int __lcong48_r (param, buffer) diff --git a/stdlib/random_r.c b/stdlib/random_r.c index d19fd1755b..677aa21ba5 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; diff --git a/stdlib/seed48_r.c b/stdlib/seed48_r.c index 31a5856a94..ec3a3ec561 100644 --- a/stdlib/seed48_r.c +++ b/stdlib/seed48_r.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <string.h> +#include <limits.h> int __seed48_r (seed16v, buffer) |