[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Remote EOF and MinGW builds
[Thread Prev] | [Thread Next]
- Subject: Re: Remote EOF and MinGW builds
- From: Thomas Schmid <schmid-thomas@xxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Sun, 04 Apr 2010 17:04:36 +0200
- To: libssh@xxxxxxxxxx
Hi, On 03.04.2010 23:48, Andreas Schneider wrote:
On Saturday 03 April 2010 23:00:15 you wrote:On Saturday 03 April 2010 12:42:33 you wrote: I've created an improved version of your code. This should work under Windows and other UNIX systems. It covers more cases and shouldn't segfault ;) http://git.libssh.org/?a=commitdiff&p=asn/libssh&h=a28c16876b4d3354c8104b8c b6c3d33fdfdddff1I've done some modifications. Look at http://git.libssh.org/?a=summary&p=asn/libssh for the latest poll-emulation.
I did not manage to build the library with your changes. Neither with the 0.4 branch nor with the code from your git repo.
While looking over the compiler errors I could fix the following:ESHUTDOWN is not defined on Windows, you should use the corresponding WSA definitions instead:
#ifdef _WIN32 if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) &&(errno == WSAESHUTDOWN || errno == WSAECONNRESET || errno == WSAECONNABORTED || errno == WSAENETRESET)) {
#else if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) &&(errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET)) {
#endif ws2_load_library contains a some typos it should be #ifdef _WIN32 static int ws2_load_library(void) { HINSTANCE hlib; hlib = LoadLibrary(WS2_LIBRARY); if (hlib == NULL) { return -1; } _win_poll = (win_poll) GetProcAddress(hlib, "WSAPoll"); if (_win_poll == NULL) { return -1; } return 0; } #endif ssh_poll() contains a double return and some typos it needs to be: int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { #ifdef _WIN32 if (_win_poll == NULL) { if (ws2_load_library() < 0) { _win_poll = bsd_poll; } } return _win_poll(fds, nfds, timeout); #else return bsd_poll(fds, nfds, timeout); #endif }This are the other compiler errors and warnings I get when trying to build the library from your repo:
D:\Projekte\libSSH\libssh-0.5\libssh\client.c: In function `ssh_connect':D:\Projekte\libSSH\libssh-0.5\libssh\client.c:699: warning: assignment from incompatible pointer type D:\Projekte\libSSH\libssh-0.5\libssh\client.c:701: warning: assignment from incompatible pointer type D:\Projekte\libSSH\libssh-0.5\libssh\connect.c:88: warning: static declaration of 'ssh_sock_set_nonblocking' follows non-static declaration D:/Projekte/libSSH/libssh-0.5/include/libssh/priv.h:157: warning: previous declaration of 'ssh_sock_set_nonblocking' was here D:\Projekte\libSSH\libssh-0.5\libssh\connect.c:93: warning: static declaration of 'ssh_sock_set_blocking' follows non-static declaration D:/Projekte/libSSH/libssh-0.5/include/libssh/priv.h:158: warning: previous declaration of 'ssh_sock_set_blocking' was here D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:142: error: conflicting types for 'ssh_socket_pollcallback' D:/Projekte/libSSH/libssh-0.5/include/libssh/socket.h:60: error: previous declaration of 'ssh_socket_pollcallback' was here D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:142: error: conflicting types for 'ssh_socket_pollcallback' D:/Projekte/libSSH/libssh-0.5/include/libssh/socket.h:60: error: previous declaration of 'ssh_socket_pollcallback' was here D:\Projekte\libSSH\libssh-0.5\libssh\socket.c: In function `ssh_socket_pollcallback': D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:147: error: `socklen_t' undeclared (first use in this function) D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:147: error: (Each undeclared identifier is reported only once D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:147: error: for each function it appears in.) D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:147: error: syntax error before "errlen" D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:154: error: `errlen' undeclared (first use in this function) D:\Projekte\libSSH\libssh-0.5\libssh\socket.c: In function `ssh_socket_register_pollcallback': D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:236: warning: passing arg 2 of `ssh_poll_set_callback' from incompatible pointer type D:\Projekte\libSSH\libssh-0.5\libssh\socket.c: In function `ssh_socket_get_poll_handle': D:\Projekte\libSSH\libssh-0.5\libssh\socket.c:248: warning: passing arg 3 of `ssh_poll_new' from incompatible pointer type
Regards Thomas
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
Re: Remote EOF and MinGW builds | Thomas Schmid <schmid-thomas@xxxxxxx> |
Re: Remote EOF and MinGW builds | Andreas Schneider <mail@xxxxxxxxxxxx> |
Re: Remote EOF and MinGW builds | Andreas Schneider <mail@xxxxxxxxxxxx> |