mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +00:00
Fix errno object handling in redbean (#392)
This commit is contained in:
parent
e6fab847a0
commit
860ea18a87
1 changed files with 2 additions and 5 deletions
|
@ -116,10 +116,6 @@ static dontinline int ReturnString(lua_State *L, const char *x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LuaUnixPushErrno(lua_State *L, int err) {
|
static void LuaUnixPushErrno(lua_State *L, int err) {
|
||||||
// TODO: How do we solve "error object is a userdata value"?
|
|
||||||
lua_pushinteger(L, err);
|
|
||||||
return;
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
struct UnixErrno *ue, **uep;
|
struct UnixErrno *ue, **uep;
|
||||||
ue = xcalloc(1, sizeof(struct UnixErrno));
|
ue = xcalloc(1, sizeof(struct UnixErrno));
|
||||||
ue->refs = 1;
|
ue->refs = 1;
|
||||||
|
@ -158,7 +154,7 @@ static int SysretBool(lua_State *L, int rc, int olderr) {
|
||||||
}
|
}
|
||||||
if (rc != -1) {
|
if (rc != -1) {
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
return 0;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return SysretErrnoBool(L, olderr);
|
return SysretErrnoBool(L, olderr);
|
||||||
}
|
}
|
||||||
|
@ -1923,6 +1919,7 @@ int LuaUnix(lua_State *L) {
|
||||||
luaL_newlib(L, kLuaUnix);
|
luaL_newlib(L, kLuaUnix);
|
||||||
LuaUnixStatObj(L);
|
LuaUnixStatObj(L);
|
||||||
LuaUnixDirObj(L);
|
LuaUnixDirObj(L);
|
||||||
|
LuaUnixErrnoObj(L);
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
lua_setglobal(L, "__signal_handlers");
|
lua_setglobal(L, "__signal_handlers");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue