mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
anetTcpGenericConnect() bug introduced in 9d19977 fixed.
Durign a refactoring I mispelled _port for port. This is one of the reasons I never used _varname myself.
This commit is contained in:
parent
cb23d510f4
commit
a2a900356e
@ -220,15 +220,15 @@ static int anetCreateSocket(char *err, int domain) {
|
||||
static int anetTcpGenericConnect(char *err, char *addr, int port, int flags)
|
||||
{
|
||||
int s = ANET_ERR, rv;
|
||||
char _port[6]; /* strlen("65535") + 1; */
|
||||
char portstr[6]; /* strlen("65535") + 1; */
|
||||
struct addrinfo hints, *servinfo, *p;
|
||||
|
||||
snprintf(_port,sizeof(port),"%d",port);
|
||||
snprintf(portstr,sizeof(portstr),"%d",port);
|
||||
memset(&hints,0,sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
if ((rv = getaddrinfo(addr,_port,&hints,&servinfo)) != 0) {
|
||||
if ((rv = getaddrinfo(addr,portstr,&hints,&servinfo)) != 0) {
|
||||
anetSetError(err, "%s", gai_strerror(rv));
|
||||
return ANET_ERR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user