use strerror_r over strerror when lfail is called

This commit is contained in:
Jeremy Baxter 2023-12-23 16:22:15 +13:00
parent dfe3e57d1c
commit 03b3631fa9

5
util.c
View file

@ -15,8 +15,11 @@
int
lfail(lua_State *L)
{
char strerrbuf[256];
luaL_pushfail(L);
lua_pushstring(L, strerror(errno));
strerror_r(errno, strerrbuf, 256);
lua_pushstring(L, strerrbuf);
lua_pushinteger(L, errno);
return 3;
}