diff options
author | saturneric <[email protected]> | 2024-01-18 05:34:39 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-18 05:34:39 +0000 |
commit | 2b2b79b968ec832f1092dce5d78d407244e0d0da (patch) | |
tree | 7f59e8ca055bf91fb26eb2784458910b40d2158a /src/core/function/ArchiveFileOperator.cpp | |
parent | fix: slove codacy issues (diff) | |
download | GpgFrontend-2b2b79b968ec832f1092dce5d78d407244e0d0da.tar.gz GpgFrontend-2b2b79b968ec832f1092dce5d78d407244e0d0da.zip |
fix: correct a fault
Diffstat (limited to 'src/core/function/ArchiveFileOperator.cpp')
-rw-r--r-- | src/core/function/ArchiveFileOperator.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index aad8b525..ef04d69f 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -160,19 +160,18 @@ void ArchiveFileOperator::NewArchive2DataExchanger( auto len = read(fd, buff.data(), buff.size()); assert(len <= buff.size() && len > 0); if (len == -1) { - GF_CORE_LOG_ERROR("read() failed, ret: {}, abort ...", r); + GF_CORE_LOG_ERROR("read() failed, ret: {}, abort ...", len); archive_entry_free(entry); close(fd); break; } + while (len > 0) { archive_write_data(archive, buff.data(), len); len = read(fd, buff.data(), buff.size()); assert(len <= buff.size() && len > 0); if (len == -1) { - GF_CORE_LOG_ERROR("read() failed, ret: {}, abort ...", r); - archive_entry_free(entry); - close(fd); + GF_CORE_LOG_ERROR("read() failed, ret: {}, abort ...", len); break; } } |