mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Ticket #4285: sftp: timestamps are not preserved for uploaded symlink.
* (sftpfs_symlink): don't call sftpfs_fix_filename() for target file bacause it breaks symlink: relative symlinks became an absolute one. * (sftpfs_utime): set timestamps only, don't touch other attributes. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
899c926fcb
commit
8e5f8255e1
@ -387,6 +387,8 @@ sftpfs_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError **
|
||||
sftpfs_super_t *super = NULL;
|
||||
const vfs_path_element_t *path_element1;
|
||||
const vfs_path_element_t *path_element2 = NULL;
|
||||
const char *path1;
|
||||
size_t path1_len;
|
||||
const GString *ctmp_path;
|
||||
char *tmp_path;
|
||||
unsigned int tmp_path_len;
|
||||
@ -400,16 +402,14 @@ sftpfs_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError **
|
||||
tmp_path_len = ctmp_path->len;
|
||||
|
||||
path_element1 = vfs_path_get_by_index (vpath1, -1);
|
||||
path1 = path_element1->path;
|
||||
path1_len = strlen (path1);
|
||||
|
||||
do
|
||||
{
|
||||
const GString *fixfname;
|
||||
|
||||
fixfname = sftpfs_fix_filename (path_element1->path);
|
||||
|
||||
res =
|
||||
libssh2_sftp_symlink_ex (super->sftp_session, fixfname->str, fixfname->len, tmp_path,
|
||||
tmp_path_len, LIBSSH2_SFTP_SYMLINK);
|
||||
libssh2_sftp_symlink_ex (super->sftp_session, path1, path1_len, tmp_path, tmp_path_len,
|
||||
LIBSSH2_SFTP_SYMLINK);
|
||||
if (res >= 0)
|
||||
break;
|
||||
|
||||
@ -448,6 +448,7 @@ sftpfs_utime (const vfs_path_t * vpath, time_t atime, time_t mtime, GError ** mc
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||
attrs.atime = atime;
|
||||
attrs.mtime = mtime;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user