On Thu, 24 Dec 2009, [email protected] wrote:

+++ b/src/agent.c
@@ -128,7 +128,7 @@ struct _LIBSSH2_AGENT
{
    LIBSSH2_SESSION *session;  /* the session this "belongs to" */

-    int fd;
+    int fd;                             /* -1 when not connected */

Hey,

Note that internally in libssh2 we use libssh2_socket_t and not 'int' for sockets so that they work better on more operating systems (like windows).

Similarly, we need a defien for "invalid sockt" as -1 is not nice to store there unconditionally for libssh2_socket_t. I suggest something like:

--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -151,8 +151,10 @@ static inline int writev(int sock, struct iovec *iov, int n

 #ifdef WIN32
 typedef SOCKET libssh2_socket_t;
+#define SOCKET_BAD ~0
 #else /* !WIN32 */
 typedef int libssh2_socket_t;
+#define SOCKET_BAD -1
 #endif /* WIN32 */

 /* RFC4253 section 6.1 Maximum Packet Length says:


--

 / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to