Handle fork server pipe read and write failures gracefully. Previously it was assumed practically impossible to fail the checks. But it could happen if the binary hit I/O errors e.g. due to non-local filesystems. PiperOrigin-RevId: 987546056
diff --git a/centipede/command.cc b/centipede/command.cc index 48ca89f..43100e4 100644 --- a/centipede/command.cc +++ b/centipede/command.cc
@@ -405,11 +405,18 @@ // Wake up the fork server. char x = ' '; - FUZZTEST_CHECK_EQ(1, write(fork_server_->pipe_[0], &x, 1)); + if (write(fork_server_->pipe_[0], &x, 1) != 1) { + LogProblemInfo( + absl::StrCat("Failed to write to fork server pipe. Errno: ", errno)); + return false; + } // Read the one-byte ack. // Use 60s as an arbitrary duration to wait for the process to load and // enter the fork server. - FUZZTEST_CHECK(fork_server_->ReadPipe(absl::Now() + absl::Seconds(60), x)); + if (!fork_server_->ReadPipe(absl::Now() + absl::Seconds(60), x)) { + LogProblemInfo("Failed to read from fork server pipe."); + return false; + } } else { FUZZTEST_CHECK_EQ(pid_, -1);