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.
This commit is contained in:
2
loslib.c
2
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);
|
||||
|
||||
Reference in New Issue
Block a user