Skip to content

Commit

Permalink
Bug fix in transfer log manager, writer thread should write when ther…
Browse files Browse the repository at this point in the history
…e is nothing to write

Summary: In TransferLogManager, writer thread was writing empty strings, which
can cause header write to fail

Reviewed By: @nikunjy

Differential Revision: D2563727
  • Loading branch information
uddipta authored and nikunjy committed Oct 21, 2015
1 parent b1bd588 commit 4fad601
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TransferLogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ void TransferLogManager::writeEntriesToDisk() {
for (const auto &entry : entries) {
buffer.append(entry);
}
if (buffer.empty()) {
// do not write when there is nothing to write
continue;
}
int toWrite = buffer.size();
int written = ::write(fd_, buffer.c_str(), toWrite);
if (written != toWrite) {
Expand Down

0 comments on commit 4fad601

Please sign in to comment.