sftp handle LIBSSH2_FX_PERMISSION_DENIED as EACCES.

When libssh2_sftp_stat_ex(LIBSSH2_SFTP_STAT|LIBSSH2_SFTP_LSTAT) returns with
LIBSSH2_ERROR_SFTP_PROTOCOL (-31) and LIBSSH2_FX_PERMISSION_DENIED (3)
handle this error case like local stat/lstat() returns -EACCES.

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 19:04:06 +00:00 committed by Andrew Borodin
parent 22076e2d8b
commit 1866f9169f
1 changed files with 12 additions and 0 deletions

View File

@ -185,6 +185,10 @@ sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
if (res >= 0)
break;
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
return -EACCES;
if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
@ -270,6 +274,10 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
if (res >= 0)
break;
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
return -EACCES;
if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
@ -489,6 +497,10 @@ sftpfs_chmod (const vfs_path_t * vpath, mode_t mode, GError ** mcerror)
if (res >= 0)
break;
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL &&
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
return -EACCES;
if (res != LIBSSH2_ERROR_EAGAIN)
{
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);