Fix OSX 10.6 / iOS 4.2
This commit is contained in:
parent
5790d25397
commit
9a9a95f99b
@ -227,7 +227,12 @@ int LJ_FASTCALL lj_prng_seed_secure(PRNGState *rs)
|
||||
** or the OS ran out of file descriptors.
|
||||
*/
|
||||
{
|
||||
#ifdef O_CLOEXEC
|
||||
int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC);
|
||||
#else
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
if (fd != -1) {
|
||||
ssize_t n = read(fd, rs->u, sizeof(rs->u));
|
||||
(void)close(fd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user