diff options
Diffstat (limited to 'src/core/function/ArchiveFileOperator.cpp')
-rw-r--r-- | src/core/function/ArchiveFileOperator.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 54c78628..aad8b525 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -159,10 +159,22 @@ void ArchiveFileOperator::NewArchive2DataExchanger( auto fd = open(archive_entry_sourcepath(entry), O_RDONLY); 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); + 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); + break; + } } close(fd); } |