summaryrefslogtreecommitdiff
path: root/core/src/xmake/io/socket_open.c
diff options
context:
space:
mode:
authorruki <[email protected]>2019-10-13 07:35:51 +0800
committerruki <[email protected]>2019-10-13 07:35:51 +0800
commit577363396ad259128813f52148547fd97f89f95b (patch)
treec6795ed6c2a1d7ca99e2723e76fb13cb47ed659c /core/src/xmake/io/socket_open.c
parent9d3eab796916f907a5fc95b4333791ee2ac6df49 (diff)
add socket.rawfd
Diffstat (limited to 'core/src/xmake/io/socket_open.c')
-rw-r--r--core/src/xmake/io/socket_open.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/core/src/xmake/io/socket_open.c b/core/src/xmake/io/socket_open.c
index 647cd247e..64cbea80e 100644
--- a/core/src/xmake/io/socket_open.c
+++ b/core/src/xmake/io/socket_open.c
@@ -59,11 +59,7 @@ tb_int_t xm_io_socket_open(lua_State* lua)
else if (!tb_strcmp(socktype, "icmp"))
t = TB_SOCKET_TYPE_ICMP;
else
- {
- lua_pushnil(lua);
- lua_pushliteral(lua, "invalid socket type!");
- return 2;
- }
+ xm_io_return_error(lua, "invalid socket type!");
// map address family
tb_size_t f = TB_IPADDR_FAMILY_NONE;
@@ -72,11 +68,7 @@ tb_int_t xm_io_socket_open(lua_State* lua)
else if (!tb_strcmp(family, "ipv6"))
f = TB_IPADDR_FAMILY_IPV6;
else
- {
- lua_pushnil(lua);
- lua_pushliteral(lua, "invalid address family!");
- return 2;
- }
+ xm_io_return_error(lua, "invalid address family!");
// init socket
tb_socket_ref_t sock = tb_socket_init(t, f);