summaryrefslogtreecommitdiff
path: root/src/netops.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-05-05 16:47:20 -0700
committerVicent Martí <tanoku@gmail.com>2012-05-05 16:47:20 -0700
commitcd58c15c589970765cd46e7bbdaebf6250fd7626 (patch)
treef7f95202e96151b3ac7ea22697e7e60825375268 /src/netops.c
parent48ecd122ea6fb8cf12fb4029974c314e5d9efb62 (diff)
parent35cdd261f353696181236328323e8d123cad57d4 (diff)
downloadlibgit2-cd58c15c589970765cd46e7bbdaebf6250fd7626.tar.gz
Merge remote-tracking branch 'scottjg/fix-mingw32' into development
Conflicts: src/netops.c src/netops.h src/transports/http.c tests-clar/clar
Diffstat (limited to 'src/netops.c')
-rw-r--r--src/netops.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/netops.c b/src/netops.c
index e2fec0b48..2d200002f 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -93,7 +93,7 @@ void gitno_consume_n(gitno_buffer *buf, size_t cons)
buf->offset -= cons;
}
-GIT_SOCKET gitno_connect(const char *host, const char *port)
+int gitno_connect(GIT_SOCKET *sock, const char *host, const char *port)
{
struct addrinfo *info = NULL, *p;
struct addrinfo hints;
@@ -106,7 +106,7 @@ GIT_SOCKET gitno_connect(const char *host, const char *port)
if ((ret = getaddrinfo(host, port, &hints, &info)) < 0) {
giterr_set(GITERR_NET, "Failed to resolve address for %s: %s", host, gai_strerror(ret));
- return INVALID_SOCKET;
+ return -1;
}
for (p = info; p != NULL; p = p->ai_next) {
@@ -125,11 +125,14 @@ GIT_SOCKET gitno_connect(const char *host, const char *port)
}
/* Oops, we couldn't connect to any address */
- if (s == INVALID_SOCKET && p == NULL)
+ if (s == INVALID_SOCKET && p == NULL) {
giterr_set(GITERR_OS, "Failed to connect to %s", host);
+ return -1;
+ }
freeaddrinfo(info);
- return s;
+ *sock = s;
+ return 0;
}
int gitno_send(GIT_SOCKET s, const char *msg, size_t len, int flags)