Only in libssh2-1.4.2/src/: libssh2_config.h
Only in libssh2-1.4.2/src/: makefile.morphos
diff -u libssh2-1.4.2_orig/src/misc.c libssh2-1.4.2/src/misc.c
--- libssh2-1.4.2_orig/src/misc.c	Thu Aug 25 18:59:47 2011
+++ libssh2-1.4.2/src/misc.c	Thu Aug  2 12:30:23 2012
@@ -107,6 +107,9 @@
         else
             return -errno;
     }
+#elif defined(HAVE_IOCTLSOCKET_CASE)
+    if (rc < 0) 
+        rc = (Errno() == EWOULDBLOCK) ? -EAGAIN : -Errno();
 #else
     if (rc < 0 ){
         /* Sometimes the first recv() function call sets errno to ENOENT on
@@ -139,6 +142,9 @@
         else
             return -errno;
     }
+#elif defined(HAVE_IOCTLSOCKET_CASE)
+    if (rc < 0) 
+        rc = (Errno() == EWOULDBLOCK) ? -EAGAIN : -Errno();
 #else
     if (rc < 0 )
         return -errno;
diff -u libssh2-1.4.2_orig/src/session.c libssh2-1.4.2/src/session.c
--- libssh2-1.4.2_orig/src/session.c	Wed Apr 18 21:24:04 2012
+++ libssh2-1.4.2/src/session.c	Sat Aug  4 18:15:13 2012
@@ -307,8 +307,8 @@
 #endif
 
 #if defined(HAVE_IOCTLSOCKET_CASE) && (SETBLOCK == 0)
-    /* presumably for Amiga */
-    return IoctlSocket(sockfd, FIONBIO, (long) nonblock);
+    /* Amiga style sockets */
+    return IoctlSocket(sockfd, FIONBIO, &nonblock);
 #undef SETBLOCK
 #define SETBLOCK 4
 #endif
@@ -368,6 +368,19 @@
     return (int) option_value;
 #undef GETBLOCK
 #define GETBLOCK 2
+#endif
+
+#if defined(__MORPHOS__) && (GETBLOCK == 0)
+    unsigned int option_value;
+    unsigned int option_len = sizeof(option_value);
+    
+    if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *) &option_value, &option_len)) {
+        /* Assume blocking on error */
+        return 1;
+    }
+    return (int) option_value;
+#undef GETBLOCK
+#define GETBLOCK 4
 #endif
 
 #if defined(HAVE_SO_NONBLOCK) && (GETBLOCK == 0)
