Commit 39b75552 authored by Dawit Alemayehu's avatar Dawit Alemayehu
Browse files

Don't call del when asked to overwrite a destination file in rename. Otherwise,

the finished signal from calling del will cause the bug reported in 255296.

BUG: 255296
FIXED-IN: 4.6.4
parent aecf4644
......@@ -1581,7 +1581,7 @@ void sftpProtocol::mkdir(const KUrl &url, int permissions) {
}
void sftpProtocol::rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags) {
kDebug(KIO_SFTP_DB) << "rename " << src << " to " << dest;
kDebug(KIO_SFTP_DB) << "rename " << src << " to " << dest << flags;
openConnection();
if (!mConnected) {
......@@ -1603,7 +1603,18 @@ void sftpProtocol::rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags
return;
}
del(dest, sb->type == SSH_FILEXFER_TYPE_DIRECTORY ? true : false);
// Delete the existing destination file/dir...
if (sb->type == SSH_FILEXFER_TYPE_DIRECTORY) {
if (sftp_rmdir(mSftp, qdest.constData()) < 0) {
reportError(dest, sftp_get_error(mSftp));
return;
}
} else {
if (sftp_unlink(mSftp, qdest.constData()) < 0) {
reportError(dest, sftp_get_error(mSftp));
return;
}
}
}
sftp_attributes_free(sb);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment