aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-02-11 22:42:28 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2010-02-11 22:42:28 +0100
commit6af2e3fc1088f2766715e824d926a8bb10d8e586 (patch)
treec8652d12d3d6cc57a90e1532b082cb7568bcaf99 /libssh
parent9bec3ee48e0d7598c0ecd5c99fba1398ddc601c9 (diff)
downloadlibssh-6af2e3fc1088f2766715e824d926a8bb10d8e586.tar.gz
libssh-6af2e3fc1088f2766715e824d926a8bb10d8e586.tar.xz
libssh-6af2e3fc1088f2766715e824d926a8bb10d8e586.zip
Fix closesocket() portbug for win32
Diffstat (limited to 'libssh')
-rw-r--r--libssh/socket.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libssh/socket.c b/libssh/socket.c
index ea8979c1..bcb86124 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -132,7 +132,7 @@ void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks){
s->callbacks=callbacks;
}
-int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){
+int ssh_socket_pollcallback(ssh_poll_handle p, socket_t fd, int revents, void *v_s){
ssh_socket s=(ssh_socket )v_s;
char buffer[4096];
int r,w;
@@ -146,7 +146,11 @@ int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){
s->poll=p=NULL;
getsockopt(fd,SOL_SOCKET,SO_ERROR,(void *)&err,&errlen);
s->last_errno=err;
+#ifdef _WIN32
+ closesocket(fd);
+#else
close(fd);
+#endif
s->fd=-1;
if(s->callbacks && s->callbacks->connected)
s->callbacks->connected(SSH_SOCKET_CONNECTED_ERROR,err,