MSNP: Fix bad return value

This commit is contained in:
Dario Casalinuovo 2015-07-20 21:19:21 +02:00
parent 53b2614595
commit 6de2682326

View File

@ -1292,7 +1292,7 @@ void * MSNP::connectToServer(std::string hostname, int port, bool *connected, bo
if ((hp = gethostbyname(hostname.c_str())) == NULL) { if ((hp = gethostbyname(hostname.c_str())) == NULL) {
errno = ECONNREFUSED; errno = ECONNREFUSED;
return (void*)-1; return NULL;
} }
memset(&sa,0,sizeof(sa)); memset(&sa,0,sizeof(sa));
@ -1301,7 +1301,7 @@ void * MSNP::connectToServer(std::string hostname, int port, bool *connected, bo
sa.sin_port = htons((u_short)port); sa.sin_port = htons((u_short)port);
if ((s = socket(hp->h_addrtype,SOCK_STREAM,0)) < 0) /* get socket */ if ((s = socket(hp->h_addrtype,SOCK_STREAM,0)) < 0) /* get socket */
return (void*)-1; return NULL;
int oldfdArgs = fcntl(s, F_GETFL, 0); int oldfdArgs = fcntl(s, F_GETFL, 0);
fcntl(s, F_SETFL, oldfdArgs | O_NONBLOCK); fcntl(s, F_SETFL, oldfdArgs | O_NONBLOCK);
@ -1309,7 +1309,7 @@ void * MSNP::connectToServer(std::string hostname, int port, bool *connected, bo
if (connect(s,(struct sockaddr *)&sa,sizeof sa) < 0) { if (connect(s,(struct sockaddr *)&sa,sizeof sa) < 0) {
if (errno != EINPROGRESS) { if (errno != EINPROGRESS) {
close(s); close(s);
return (void*)-1; return NULL;
} }
*connected = false; *connected = false;
} else { } else {