1
0
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:
Andreas Jaeger
2013-04-29 21:02:16 +02:00
parent b1a36ceb3b
commit 9ce3b2cbd2
3 changed files with 8 additions and 3 deletions

View File

@ -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)