Minor fixes to the launcher refactor
Bug: 110478603
Test: local
Change-Id: Ibb2e265a23b8d8e12fbd326b69dce0f0bd5bc5d4
diff --git a/host/commands/launch/main.cc b/host/commands/launch/main.cc
index f3bc1e0..36fe5b7 100644
--- a/host/commands/launch/main.cc
+++ b/host/commands/launch/main.cc
@@ -774,8 +774,11 @@
} else if (child_pid == 0) {
// The child makes sure it is in a different process group before
// killing everyone on its parent's
- // This call never fails (see SETPGID(2))
- setpgid(0, 0);
+ // This call should never fail (see SETPGID(2))
+ if (setpgid(0, 0) != 0) {
+ LOG(ERROR) << "setpgid failed (" << strerror(errno)
+ << ") the launcher's child is about to kill itself";
+ }
killpg(pgid, SIGKILL);
return true;
} else {
@@ -791,7 +794,7 @@
// TODO: use select to handle simultaneous connections.
auto client = cvd::SharedFD::Accept(*server);
cvd::LauncherAction action;
- while (client->IsOpen() && client->Read(&action, sizeof(char)) > 0) {
+ while (client->IsOpen() && client->Read(&action, sizeof(action)) > 0) {
switch (action) {
case cvd::LauncherAction::kStop:
if (StopCvd(vm_manager)) {
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index be18bce..9dee733 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -323,8 +323,8 @@
return (*dictionary_)[kLauncherMonitorPath].asString();
}
void CuttlefishConfig::set_launcher_monitor_socket_path(
- const std::string& launhcer_monitor_path) {
- (*dictionary_)[kLauncherMonitorPath] = launhcer_monitor_path;
+ const std::string& launcher_monitor_path) {
+ SetPath(kLauncherMonitorPath, launcher_monitor_path);
}
std::string CuttlefishConfig::launcher_log_path() const {