lua's math_randomseed needs srand_deterministic, pointed out by tedu

This commit is contained in:
sthen 2014-12-10 00:44:52 +00:00
parent a41021e79b
commit cd0f18112b
4 changed files with 28 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.3 2014/09/09 13:54:43 jasper Exp $
# $OpenBSD: Makefile,v 1.4 2014/12/10 00:44:52 sthen Exp $
VERSION= 5.1.5
PKGSPEC= lua->=5.1,<5.2
REVISION= 2
REVISION= 3
SHARED_LIBS= lua5.1 ${VERSION:R}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_lmathlib_c,v 1.1 2014/12/10 00:44:53 sthen Exp $
--- src/lmathlib.c.orig Wed Dec 10 00:42:41 2014
+++ src/lmathlib.c Wed Dec 10 00:42:46 2014
@@ -207,7 +207,7 @@ static int math_random (lua_State *L) {
static int math_randomseed (lua_State *L) {
- srand(luaL_checkint(L, 1));
+ srand_deterministic(luaL_checkint(L, 1));
return 0;
}

View File

@ -1,6 +1,7 @@
# $OpenBSD: Makefile,v 1.5 2014/08/10 09:58:05 espie Exp $
# $OpenBSD: Makefile,v 1.6 2014/12/10 00:44:53 sthen Exp $
VERSION= 5.2.3
REVISION= 0
PKGSPEC= lua->=5.2,<5.3
SHARED_LIBS= lua5.2 ${VERSION:R}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_lmathlib_c,v 1.1 2014/12/10 00:44:53 sthen Exp $
--- src/lmathlib.c.orig Wed Dec 10 00:41:49 2014
+++ src/lmathlib.c Wed Dec 10 00:42:28 2014
@@ -224,7 +224,7 @@ static int math_random (lua_State *L) {
static int math_randomseed (lua_State *L) {
- srand(luaL_checkunsigned(L, 1));
+ srand_deterministic(luaL_checkunsigned(L, 1));
(void)rand(); /* discard first value to avoid undesirable correlations */
return 0;
}