Skip to content

Commit

Permalink
Snap for 11772614 from 4eff9eb72fec3fb7c199c16375daefb39358bacc to 24…
Browse files Browse the repository at this point in the history
…Q3-release

Change-Id: I10a3c1f419ba2547118ca9dea3d6d5da2485149d
  • Loading branch information
Android Build Coastguard Worker authored and cjreynol committed Jan 23, 2025
1 parent 3ff44ac commit 06424df
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions base/cvd/cuttlefish/host/commands/logcat_receiver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ int main(int argc, char** argv) {
auto logcat_file =
cuttlefish::SharedFD::Open(path.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666);

bool first_iter = true;
// Server loop
while (true) {
char buff[1024];
Expand All @@ -74,35 +73,9 @@ int main(int argc, char** argv) {
break;
}
auto written = cuttlefish::WriteAll(logcat_file, buff, read);
CHECK(written == read)
<< "Error writing to log file: " << logcat_file->StrError()
<< ". This is unrecoverable.";
if (first_iter) {
first_iter = false;
if (cuttlefish::IsRestoring(*config)) {
cuttlefish::SharedFD restore_pipe = cuttlefish::SharedFD::Open(
instance.restore_pipe_name().c_str(), O_WRONLY);
if (!restore_pipe->IsOpen()) {
LOG(ERROR) << "Error opening restore pipe: "
<< restore_pipe->StrError();
return 2;
}
cuttlefish::SharedFD restore_adbd_pipe = cuttlefish::SharedFD::Open(
instance.restore_adbd_pipe_name().c_str(), O_WRONLY);
if (!restore_adbd_pipe->IsOpen()) {
LOG(ERROR) << "Error opening restore pipe: "
<< restore_adbd_pipe->StrError();
return 2;
}

CHECK(cuttlefish::WriteAll(restore_pipe, "1") == 1)
<< "Error writing to restore pipe: " << restore_pipe->StrError()
<< ". This is unrecoverable.";
CHECK(cuttlefish::WriteAll(restore_adbd_pipe, "2") == 1)
<< "Error writing to adbd restore pipe: "
<< restore_adbd_pipe->StrError() << ". This is unrecoverable.";
}
}
CHECK(written == read) << "Error writing to log file: "
<< logcat_file->StrError()
<< ". This is unrecoverable.";
}

logcat_file->Close();
Expand Down

0 comments on commit 06424df

Please sign in to comment.