For some combinations of variable sizes and RAND_MAX value rand_r()

may store less amount bits for seed, than available. Fix it.
This commit is contained in:
ache 2003-02-02 14:27:51 +00:00
parent 499b47780f
commit 9b500bf3eb

View File

@ -86,8 +86,10 @@ int
rand_r(unsigned int *ctx)
{
u_long val = (u_long) *ctx;
*ctx = do_rand(&val);
return (int) *ctx;
int r = do_rand(&val);
*ctx = (unsigned int) val;
return (r);
}