mirror of https://github.com/MidnightCommander/mc
Fix sftp error 31 (proto 4 and 2)
See https://midnight-commander.org/ticket/3406#comment:13 and https://midnight-commander.org/ticket/3406#comment:16. Both _lstat and _stat need to handle NO_SUCH_FILE while copying to a remote sftp. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
1866f9169f
commit
a241f472bf
|
@ -189,6 +189,12 @@ sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
|
|||
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
|
||||
return -EACCES;
|
||||
|
||||
/* perhaps the copy function tries to stat destination file
|
||||
to make sure it's not overwriting anything */
|
||||
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL
|
||||
&& libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_NO_SUCH_FILE)
|
||||
return -ENOENT;
|
||||
|
||||
if (res != LIBSSH2_ERROR_EAGAIN)
|
||||
{
|
||||
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
|
||||
|
@ -278,6 +284,12 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
|
|||
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
|
||||
return -EACCES;
|
||||
|
||||
/* perhaps the copy function tries to stat destination file
|
||||
to make sure it's not overwriting anything */
|
||||
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL
|
||||
&& libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_NO_SUCH_FILE)
|
||||
return -ENOENT;
|
||||
|
||||
if (res != LIBSSH2_ERROR_EAGAIN)
|
||||
{
|
||||
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
|
||||
|
@ -501,6 +513,13 @@ sftpfs_chmod (const vfs_path_t * vpath, mode_t mode, GError ** mcerror)
|
|||
libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_PERMISSION_DENIED)
|
||||
return -EACCES;
|
||||
|
||||
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL
|
||||
&& libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_FAILURE)
|
||||
{
|
||||
res = 0; /* need something like ftpfs_ignore_chattr_errors */
|
||||
break;
|
||||
}
|
||||
|
||||
if (res != LIBSSH2_ERROR_EAGAIN)
|
||||
{
|
||||
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
|
||||
|
@ -527,6 +546,17 @@ 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_NO_SUCH_FILE)
|
||||
return -ENOENT;
|
||||
|
||||
if (res == LIBSSH2_ERROR_SFTP_PROTOCOL
|
||||
&& libssh2_sftp_last_error (super_data->sftp_session) == LIBSSH2_FX_FAILURE)
|
||||
{
|
||||
res = 0; /* need something like ftpfs_ignore_chattr_errors */
|
||||
break;
|
||||
}
|
||||
|
||||
if (res != LIBSSH2_ERROR_EAGAIN)
|
||||
{
|
||||
sftpfs_ssherror_to_gliberror (super_data, res, mcerror);
|
||||
|
|
Loading…
Reference in New Issue