diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/inet.c | 3 | ||||
| -rw-r--r-- | src/tcp.c | 1 |
2 files changed, 3 insertions, 1 deletions
| @@ -478,6 +478,9 @@ const char *inet_trybind(p_socket ps, const char *address, const char *serv, | |||
| 478 | struct addrinfo *iterator = NULL, *resolved = NULL; | 478 | struct addrinfo *iterator = NULL, *resolved = NULL; |
| 479 | const char *err = NULL; | 479 | const char *err = NULL; |
| 480 | t_socket sock = *ps; | 480 | t_socket sock = *ps; |
| 481 | /* translate luasocket special values to C */ | ||
| 482 | if (strcmp(address, "*") == 0) address = NULL; | ||
| 483 | if (!serv) serv = "0"; | ||
| 481 | /* try resolving */ | 484 | /* try resolving */ |
| 482 | err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved)); | 485 | err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved)); |
| 483 | if (err) { | 486 | if (err) { |
| @@ -222,7 +222,6 @@ static int meth_bind(lua_State *L) | |||
| 222 | bindhints.ai_socktype = SOCK_STREAM; | 222 | bindhints.ai_socktype = SOCK_STREAM; |
| 223 | bindhints.ai_family = tcp->family; | 223 | bindhints.ai_family = tcp->family; |
| 224 | bindhints.ai_flags = AI_PASSIVE; | 224 | bindhints.ai_flags = AI_PASSIVE; |
| 225 | address = strcmp(address, "*")? address: NULL; | ||
| 226 | err = inet_trybind(&tcp->sock, address, port, &bindhints); | 225 | err = inet_trybind(&tcp->sock, address, port, &bindhints); |
| 227 | if (err) { | 226 | if (err) { |
| 228 | lua_pushnil(L); | 227 | lua_pushnil(L); |
