Ticket #3406: sftpfs: fix -31 SFTP Protocol Error when transferring file via SFTP Link.

Initial commit: extend error message with sftp session error.

When LIBSSH2_ERROR_SFTP_PROTOCOL (-31) occurs extend error message
with sftp last error for better failure tracking.

With #3269 patch further sftp protocol error message now looks like
SFTP Protocol Error 3 (-31).

Currently I have no nice solution for print relevant called libssh2 function too
I don't want pollute _to_gliberror() with contant strings all over.

sftp session error 3 means (file) permission denied.

From libssh2-1.5.0/include/libssh2_sftp.h

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andreas Mohr 2016-01-07 16:59:06 +00:00 committed by Andrew Borodin
parent 218dcea543
commit 22076e2d8b

View File

@ -65,7 +65,11 @@ sftpfs_ssherror_to_gliberror (sftpfs_super_data_t * super_data, int libssh_errno
mc_return_if_error (mcerror);
libssh2_session_last_error (super_data->session, &err, &err_len, 1);
mc_propagate_error (mcerror, libssh_errno, "%s", err);
if (libssh_errno == LIBSSH2_ERROR_SFTP_PROTOCOL && super_data->sftp_session != NULL)
mc_propagate_error (mcerror, libssh_errno, "%s %lu", err,
libssh2_sftp_last_error (super_data->sftp_session));
else
mc_propagate_error (mcerror, libssh_errno, "%s", err);
g_free (err);
}