diff options
author | William Swanson <swansontec@gmail.com> | 2014-09-24 12:01:14 -0700 |
---|---|---|
committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2014-10-03 17:38:20 +0200 |
commit | b59357797922c7482d973da3cbec307f132f77ba (patch) | |
tree | b73adef1ae2631c1c9ab9a554d02d8e2a07a6972 | |
parent | ba5cef034dbc9aa41a60f67e5748be0e1329eeb6 (diff) | |
download | libgit2-b59357797922c7482d973da3cbec307f132f77ba.tar.gz |
Correctly handle getaddrinfo return result
The getaddrinfo function indicates failure with a non-zero return code,
but this code is not necessarily negative. On platforms like Android
where the code is positive, a failed call causes libgit2 to segfault.
-rw-r--r-- | src/netops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netops.c b/src/netops.c index 8a60299c2..ea5d4ed2e 100644 --- a/src/netops.c +++ b/src/netops.c @@ -460,7 +460,7 @@ int gitno_connect(gitno_socket *s_out, const char *host, const char *port, int f hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_UNSPEC; - if ((ret = p_getaddrinfo(host, port, &hints, &info)) < 0) { + if ((ret = p_getaddrinfo(host, port, &hints, &info)) != 0) { giterr_set(GITERR_NET, "Failed to resolve address for %s: %s", host, p_gai_strerror(ret)); return -1; |