Commit 7bb2c797 authored by Harald Sitter's avatar Harald Sitter 🏳🌈
Browse files

sftp: extra verbosity when put fails

for not entirely clear reasons certain servers will fall over after we've
written our data. log internal sftp and ssh errors to aid in debugging

CCBUG: 418472
parent 08b2a24d
......@@ -1722,10 +1722,14 @@ Result SFTPInternal::sftpPut(const QUrl &url, int permissions, JobFlags flags, i
if (fd == -1) {
q->dataReq(); // Request for data
result = q->readData(buffer);
if (result < 0) {
qCDebug(KIO_SFTP_LOG) << "unexpected error during readData";
}
} else {
char buf[MAX_XFER_BUF_SIZE]; //
result = ::read(fd, buf, sizeof(buf));
if(result < 0) {
if (result < 0) {
qCDebug(KIO_SFTP_LOG) << "failed to read" << errno;
errorCode = ERR_CANNOT_READ;
break;
}
......@@ -1792,6 +1796,10 @@ Result SFTPInternal::sftpPut(const QUrl &url, int permissions, JobFlags flags, i
ssize_t bytesWritten = sftp_write(file, buffer.data(), buffer.size());
if (bytesWritten < 0) {
qCDebug(KIO_SFTP_LOG) << "Failed to sftp_write" << buffer.size() << "bytes."
<< "- Already written: " << totalBytesSent
<< "- SFTP error:" << sftp_get_error(mSftp)
<< "- SSH error:" << ssh_get_error_code(mSession);
errorCode = KIO::ERR_CANNOT_WRITE;
result = -1;
} else {
......
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