libssh2_sftp_init hang: last error not set

The problem is that the original if statement simply returns NULL, but does not set the session last error code. The consequence is that libssh2_sftp_init() also returns NULL and libssh2_session_last_errno(sshSession) == LIBSSH2_ERROR_NONE.

In my test the LIBSSH2_ERROR_EAGAIN is coming from sftp.c row 337:
            if(4 != sftp->partial_size_len)
                /* we got a short read for the length part */
                return LIBSSH2_ERROR_EAGAIN;

with "partial_size_len == 0". Not sure if this is expected.
1 file changed