D27871: sftp: fix seekPos + file resuming when part file is of size 11

Harald Sitter noreply at phabricator.kde.org
Tue Mar 10 13:25:26 GMT 2020


sitter added inline comments.

INLINE COMMENTS

> bruns wrote in kio_sftp.cpp:1687
> Essentially, apply the change from the man page example to the code here:
> 
>   if (pos != sbPart->size) {
>       int errsv = errno;
>       qCDebug(KIO_SFTP_LOG) << "Failed to seek to" << sbPart->size << "bytes in source file. Reason given:" << strerror(errsv);
>   }
> 
> As the errno value is now held in a local variable (and thus the global/thread-local errno does not matter), no function called from qCDebug() is able to mess with the value. qCDebug() *may* call all kind of functions (remember, it may log to the terminal, to the system journal, ...) which may fail in a non-fatal way ("if this does not work, try that"), overwriting errno in the course.
> 
> Making assumptions about errno can lead to some surprises, and while it may work most of the time it is better to be save than sorry.

Can **you** please make a diff for that?

  fish/fish.cpp:        myDebug( << "socketpair failed, error: " << strerror(errno));
  fish/fish.cpp:        myDebug( << "fork failed, error: " << strerror(errno));
  fish/fish.cpp:        myDebug( << "could not exec! " << strerror(errno));
  fish/fish.cpp:            myDebug( << "select failed, rc: " << rc << ", error: " << strerror(errno));
  fish/fish.cpp:                myDebug( << "write failed, rc: " << rc << ", error: " << strerror(errno));
  fish/fish.cpp:                myDebug( << "read failed, rc: " << rc << ", error: " << strerror(errno));
  fish/fish.cpp:                myDebug( << "select failed, rc: " << rc << ", error: " << strerror(errno));
  fish/fish.cpp:                    myDebug( << "write failed, rc: " << rc << ", error: " << strerror(errno));
  fish/fish.cpp:                    myDebug( << "read failed, rc: " << rc << ", error: " << strerror(errno));
  sftp/kio_sftp.cpp:                    qCDebug(KIO_SFTP_LOG) << "Failed to seek to" << sbPart->size << "bytes in source file. Reason given" << strerror(errno);
  smb/kio_smb_dir.cpp:            qCDebug(KIO_SMB) << "failed to rename" << dstUrl << "to" << dstOrigUrl << "->" << strerror(errno);
  smb/kio_smb_browse.cpp:        return SMBError{ ERR_INTERNAL, i18n("Unknown error condition in stat: %1", QString::fromLocal8Bit( strerror(errNum))) };

REPOSITORY
  R320 KIO Extras

REVISION DETAIL
  https://phabricator.kde.org/D27871

To: sitter, ngraham, feverfew
Cc: bruns, kde-frameworks-devel, kfm-devel, pberestov, iasensio, fprice, LeGast00n, cblack, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200310/c1ef45c8/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list