fixup! fixup! fix: ensure all bytes read / written to file (#2682) (#2780) (#3035)

fix spurious tr_error being set when reading up to eof

Fix error introduced in the previous fixup :P
This commit is contained in:
Charles Kerr 2022-04-30 18:43:32 -05:00 committed by GitHub
parent c8f5cff564
commit 4cc952f0ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -158,7 +158,7 @@ int readOrWriteBytes(
switch (io_mode)
{
case IoMode::Read:
if (!readEntireBuf(*fd, file_offset, buf, buflen, &error))
if (!readEntireBuf(*fd, file_offset, buf, buflen, &error) && error != nullptr)
{
err = error->code;
tr_logAddErrorTor(
@ -173,7 +173,7 @@ int readOrWriteBytes(
break;
case IoMode::Write:
if (!writeEntireBuf(*fd, file_offset, buf, buflen, &error))
if (!writeEntireBuf(*fd, file_offset, buf, buflen, &error) && error != nullptr)
{
err = error->code;
tr_logAddErrorTor(