From 52bdabe75e3811ecc10637cf08715c08df78da14 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Thu, 7 Jan 2016 19:04:06 +0000
Subject: [PATCH] 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>
---
src/vfs/sftpfs/internal.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index f060ecf..a05ca8b 100644
a
|
b
|
sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror) |
166 | 166 | if (res >= 0) |
167 | 167 | break; |
168 | 168 | |
| 169 | if (res == LIBSSH2_ERROR_SFTP_PROTOCOL && |
| 170 | libssh2_sftp_last_error(super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED) |
| 171 | return EACCES; |
| 172 | |
169 | 173 | if (res != LIBSSH2_ERROR_EAGAIN) |
170 | 174 | { |
171 | 175 | sftpfs_ssherror_to_gliberror (super_data, res, mcerror); |
… |
… |
sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror) |
244 | 248 | if (res >= 0) |
245 | 249 | break; |
246 | 250 | |
| 251 | if (res == LIBSSH2_ERROR_SFTP_PROTOCOL && |
| 252 | libssh2_sftp_last_error(super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED) |
| 253 | return EACCES; |
| 254 | |
247 | 255 | if (res != LIBSSH2_ERROR_EAGAIN) |
248 | 256 | { |
249 | 257 | sftpfs_ssherror_to_gliberror (super_data, res, mcerror); |
… |
… |
sftpfs_chmod (const vfs_path_t * vpath, mode_t mode, GError ** mcerror) |
450 | 458 | if (res >= 0) |
451 | 459 | break; |
452 | 460 | |
| 461 | if (res == LIBSSH2_ERROR_SFTP_PROTOCOL && |
| 462 | libssh2_sftp_last_error(super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED) |
| 463 | return EACCES; |
| 464 | |
453 | 465 | if (res != LIBSSH2_ERROR_EAGAIN) |
454 | 466 | { |
455 | 467 | sftpfs_ssherror_to_gliberror (super_data, res, mcerror); |