mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
BZ#15380: Fix initstate error return
[BZ #15380] * stdlib/random.c (__initstate): Return NULL if __initstate fails.
This commit is contained in:
@ -234,16 +234,17 @@ __initstate (seed, arg_state, n)
|
||||
size_t n;
|
||||
{
|
||||
int32_t *ostate;
|
||||
int ret;
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
ostate = &unsafe_state.state[-1];
|
||||
|
||||
__initstate_r (seed, arg_state, n, &unsafe_state);
|
||||
ret = __initstate_r (seed, arg_state, n, &unsafe_state);
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return (char *) ostate;
|
||||
return ret == -1 ? NULL : (char *) ostate;
|
||||
}
|
||||
|
||||
weak_alias (__initstate, initstate)
|
||||
|
Reference in New Issue
Block a user