_libssh2_recv(): handle ENOENT error as EAGAIN

A sftp session failed with error "failure establishing ssh session" on
Solaris and HP-UX. Sometimes the first recv() function call sets errno
to ENOENT. In the man pages for recv of Solaris and HP-UX the error
ENOENT is not documented.

I tested Solaris SPARC and x86, HP-UX i64, AIX, Windows and Linux.
This commit is contained in:
Alfred Gebert 2011-06-28 22:43:50 +02:00 committed by Daniel Stenberg
parent 2db7d9c655
commit 733bf877f8

View File

@ -108,8 +108,14 @@ _libssh2_recv(libssh2_socket_t sock, void *buffer, size_t length, int flags)
return -errno;
}
#else
if (rc < 0 )
if (rc < 0 ){
/* Sometimes the first recv() function call sets errno to ENOENT on
Solaris and HP-UX */
if ( errno == ENOENT )
return -EAGAIN;
else
return -errno;
}
#endif
return rc;
}