bruns added inline comments.

INLINE COMMENTS

> kio_sftp.cpp:1687
>                  if (pos != sbPart->size) {
> -                    qCDebug(KIO_SFTP_LOG) << "Failed to seek to" << 
> sbPart->size << "bytes in source file. Reason given" << strerror(errno);
> +                    qCDebug(KIO_SFTP_LOG) << "Failed to seek to" << 
> sbPart->size << "bytes in source file. Reason given:" << strerror(errno);
>                      sftp_attributes_free(sb);

You should save errno immediately after QT_LSEEK, otherwise any function may 
overwrite it. See `man 3 errno`:

> A common mistake is to do
> 
>   if (somecall() == -1) {
>       printf("somecall() failed\n");
>       if (errno == ...) { ... }
>   }
>    
> 
> where errno no longer needs to have the value it had upon return from 
> somecall() (i.e., it may have been changed by the printf(3)).  If the value 
> of errno should be preserved across a library call, it must be saved:
> 
>   if (somecall() == -1) {
>       int errsv = errno;
>       printf("somecall() failed\n");
>       if (errsv == ...) { ... }
>   }
>

> kio_sftp.cpp:1955
>          fd = QT_OPEN( QFile::encodeName(sPart), O_RDWR );  // append if 
> resuming
> -        offset = seekPos(fd, 0, SEEK_END);
> -        if(offset < 0) {
> +        offset = QT_LSEEK(fd, partFile.size(), SEEK_SET);
> +        if (offset != partFile.size()) {

dito

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

Reply via email to