random_r.3: Note that 'buf' records a pointer to 'statebuf'

See https://sourceware.org/bugzilla/show_bug.cgi?id=3662.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-01-25 09:49:08 +13:00
parent a689fdb223
commit 516a39595e
1 changed files with 17 additions and 0 deletions

View File

@ -97,6 +97,23 @@ rather than initializing the global state variable.
Before calling this function, the
.IR buf.state
field must be initialized to NULL.
The
.BR initstate_r ()
function records a pointer to the
.I statebuf
argument inside the structure pointed to by
.IR buf .
Thus,
.IR statebuf
should not be deallocated so long as
.IR buf
is still in use.
(So,
.I statebuf
should typically be allocated as a static variable,
or allocated on the heap using
.BR malloc (3)
or similar.)
The
.BR setstate_r ()