MCPcopy Create free account
hub / github.com/Tencent/UnLua / opt_get_error

Function opt_get_error

Plugins/UnLuaExtensions/LuaSocket/Source/src/options.cpp:335–346  ·  view source on GitHub ↗

------------------------------------------------------*/

Source from the content-addressed store, hash-verified

333
334/*------------------------------------------------------*/
335int opt_get_error(lua_State *L, p_socket ps)
336{
337 int val = 0;
338 socklen_t len = sizeof(val);
339 if (getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *) &val, &len) < 0) {
340 lua_pushnil(L);
341 lua_pushstring(L, "getsockopt failed");
342 return 2;
343 }
344 lua_pushstring(L, socket_strerror(val));
345 return 1;
346}
347
348/*=========================================================================*\
349* Auxiliar functions

Callers

nothing calls this directly

Calls 3

lua_pushnilFunction · 0.85
lua_pushstringFunction · 0.85
socket_strerrorFunction · 0.70

Tested by

no test coverage detected