Skip to content
Tcl Source Code View Ticket
Login

View Ticket

broken compat/mkstemp.c

Closed / Fixed2819227fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-07-09 20:35:35
Doing a test build of HEAD on an
IRIX64 6.5 system, apparently the
mkstemp() replacement routine in
compat/mkstemp.c is called into
service.

It segfaults.

Tracking it down, the problem is that
the code assumes the range of the
random() function is bounded by
RAND_MAX.  At least on this system
that is false.  RAND_MAX bounds
the range of the rand() call and has
a much smaller value than the range
of the random() call.

Simpleminded fix is to replace 
the random() call with a rand()
call instead.
dkfplain2009-07-10 05:29:07
allow_comments - 1

Grrr! The OSX documentation round here is rather broken. (It gets confused between the standard and the sub-library of OpenSSL that happens to have a similar name, and it recommends using random() instead of rand() anyway.) What a mess.
Log in (anonymous is fine) to add a comment.