Compare commits

...

2 Commits

Author SHA1 Message Date
georgeto
8f816d0972
Merge d7856b222d02532412cec7c018bbd6cf33eca91f into 8c2ff7217e2a205eb107a6f48b04ff1b2b3090a1 2022-11-24 10:03:02 +08:00
georgeto
d7856b222d fix(inet): Return port as number in getsockname
The documentation of getsockname() states that the port is returned as
a number, which is also what the similar getpeername function does.

Closes #391
2022-09-11 02:11:47 +02:00

View File

@ -290,7 +290,7 @@ int inet_meth_getsockname(lua_State *L, p_socket ps, int family)
return 2;
}
lua_pushstring(L, name);
lua_pushstring(L, port);
lua_pushinteger(L, (int) strtol(port, (char **) NULL, 10));
switch (family) {
case AF_INET: lua_pushliteral(L, "inet"); break;
case AF_INET6: lua_pushliteral(L, "inet6"); break;