aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-07-27 15:50:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-07-27 15:50:53 -0300
commit3d838f635cc81ec3332f9a904992db1c6d8a46ad (patch)
treefe2e9aa951d3e0dd464481697d4fb671bde70e65 /loslib.c
parentaa4c5cf190f77ab2730af5e21cfd2b830ff329df (diff)
downloadlua-3d838f635cc81ec3332f9a904992db1c6d8a46ad.tar.gz
lua-3d838f635cc81ec3332f9a904992db1c6d8a46ad.tar.bz2
lua-3d838f635cc81ec3332f9a904992db1c6d8a46ad.zip
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.
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c2
1 files changed, 2 insertions, 0 deletions
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) {
166 char buff[LUA_TMPNAMBUFSIZE]; 166 char buff[LUA_TMPNAMBUFSIZE];
167 int err; 167 int err;
168 lua_tmpnam(buff, err); 168 lua_tmpnam(buff, err);
169 if (err && luaL_resourcetryagain(L)) /* resource failure? */
170 lua_tmpnam(buff, err); /* try again */
169 if (err) 171 if (err)
170 return luaL_error(L, "unable to generate a unique filename"); 172 return luaL_error(L, "unable to generate a unique filename");
171 lua_pushstring(L, buff); 173 lua_pushstring(L, buff);