diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-04-26 12:09:57 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-04-26 12:17:15 +0200 |
| commit | 954e06a8d76553b7d3645aff3a3a6a18e41dcf9c (patch) | |
| tree | 14b079574785fc8f03929f9a98c5c25d83ce4100 /src/socket_stream.c | |
| parent | 0d2f6824ebf0bf9cb6c2bfb0ac9072d9dbb474c0 (diff) | |
| download | libgit2-954e06a8d76553b7d3645aff3a3a6a18e41dcf9c.tar.gz | |
socket_stream: continue to next addrinfo on socket creation failure
When connecting to a remote via socket stream, we first use getaddrinfo
to obtain the possible connection methods followed by creating and
connecting the socket. But when creating the socket, we error out as
soon as we get an invalid socket instead of trying out other address
hints returned by addrinfo.
Fix this by continuing on invalid socket instead of returning an error.
This fixes connection establishment with musl libc.
Diffstat (limited to 'src/socket_stream.c')
| -rw-r--r-- | src/socket_stream.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/socket_stream.c b/src/socket_stream.c index fca411717..c0a168448 100644 --- a/src/socket_stream.c +++ b/src/socket_stream.c @@ -106,10 +106,8 @@ int socket_connect(git_stream *stream) for (p = info; p != NULL; p = p->ai_next) { s = socket(p->ai_family, p->ai_socktype, p->ai_protocol); - if (s == INVALID_SOCKET) { - net_set_error("error creating socket"); - break; - } + if (s == INVALID_SOCKET) + continue; if (connect(s, p->ai_addr, (socklen_t)p->ai_addrlen) == 0) break; |
