From 3d838f635cc81ec3332f9a904992db1c6d8a46ad Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 27 Jul 2018 15:50:53 -0300 Subject: Added "emergency collection" to 'io.tmpfile' and 'os.tmpname' These operations also can give errors for lack of resources, so they also will try "emergency collections" in case of resource errors. Because there are now two libraries with that kind of handling, 'resourcetryagain' was moved to the auxiliary library to be shared by the libraries. --- loslib.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'loslib.c') diff --git a/loslib.c b/loslib.c index 8809e5ea..1962f55f 100644 --- a/loslib.c +++ b/loslib.c @@ -166,6 +166,8 @@ static int os_tmpname (lua_State *L) { char buff[LUA_TMPNAMBUFSIZE]; int err; lua_tmpnam(buff, err); + if (err && luaL_resourcetryagain(L)) /* resource failure? */ + lua_tmpnam(buff, err); /* try again */ if (err) return luaL_error(L, "unable to generate a unique filename"); lua_pushstring(L, buff); -- cgit v1.2.3-55-g6feb