diff options
author | Scott J. Goldman <scottjgo@gmail.com> | 2012-05-05 13:30:33 -0700 |
---|---|---|
committer | Scott J. Goldman <scottjgo@gmail.com> | 2012-05-05 13:33:46 -0700 |
commit | b4b96d56bf1d9f362441e5e650b023040a319e05 (patch) | |
tree | abf206b51008b047ed5552ebde11831309fc3cec /src/netops.h | |
parent | 06ac3e7f345d8ab257f77bf567d671c0b65c378c (diff) | |
download | libgit2-b4b96d56bf1d9f362441e5e650b023040a319e05.tar.gz |
Fix gitno_connect() error handling on Windows
gitno_connect() can return an error or socket, which is fine on most
platforms where sockets are file descriptors (signed int), but on Windows,
SOCKET is an unsigned type, which is problematic when we are trying to
test if the socket was actually a negative error code.
This fix seperates the error code and socket in gitno_connect(), and fixes
the error handling in do_connect() functions to compensate. It appears
that git_connect() and the git-transport do_connect() functions had bugs
in the non-windows cases too (leaking sockets, and not properly reporting
connection error, respectively) so I went ahead and fixed those too.
Diffstat (limited to 'src/netops.h')
-rw-r--r-- | src/netops.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netops.h b/src/netops.h index 01ad9714f..cef39d923 100644 --- a/src/netops.h +++ b/src/netops.h @@ -25,7 +25,7 @@ int gitno_recv(gitno_buffer *buf); void gitno_consume(gitno_buffer *buf, const char *ptr); void gitno_consume_n(gitno_buffer *buf, size_t cons); -int gitno_connect(const char *host, const char *port); +int gitno_connect(const char *host, const char *port, GIT_SOCKET *s); int gitno_send(GIT_SOCKET s, const char *msg, size_t len, int flags); int gitno_close(GIT_SOCKET s); int gitno_send_chunk_size(int s, size_t len); |