make sure that bytes only get added to bytesRead when bytes > 0

This commit is contained in:
“Lincoln 2021-09-24 17:52:19 -07:00 committed by Markus Pilman
parent cd25d42d66
commit 112d7fe632
1 changed files with 2 additions and 1 deletions

View File

@ -175,7 +175,8 @@ ACTOR Future<int> spawnProcess(std::string path,
loop {
int bytes =
read(readFD.get(), &outputBuffer[bytesRead], SERVER_KNOBS->MAX_FORKED_PROCESS_OUTPUT - bytesRead);
bytesRead += bytes;
if (bytes > 0)
bytesRead += bytes;
if (bytes < 0 && errno == EAGAIN)
break;
else if (bytes < 0)