Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
#include <filesystem>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <mutex>
#include <thread>
#include <unordered_map>

#include <cstdlib>
Expand Down Expand Up @@ -376,7 +374,7 @@ std::map<pid_t, std::string> start_modules(ManagerConfig& config, MQTTAbstractio
continue;
}

// FIXME (aw): implicitely adding ModuleReadyInfo and setting its ready member
// FIXME (aw): implicitly adding ModuleReadyInfo and setting its ready member
auto module_it = modules_ready.emplace(module_id, ModuleReadyInfo{false, nullptr, nullptr}).first;

std::vector<std::string> capabilities;
Expand All @@ -386,7 +384,7 @@ std::map<pid_t, std::string> start_modules(ManagerConfig& config, MQTTAbstractio
}

if (not capabilities.empty()) {
EVLOG_info << fmt::format("Module {} wants to aquire the following capabilities: {}", module_name,
EVLOG_info << fmt::format("Module {} wants to acquire the following capabilities: {}", module_name,
fmt::join(capabilities.begin(), capabilities.end(), " "));
}

Expand Down Expand Up @@ -845,7 +843,7 @@ int boot(const po::variables_map& vm) {

const auto module_iter = module_handles.find(pid);
if (module_iter == module_handles.end()) {
throw std::runtime_error(fmt::format("Unkown child width pid ({}) died.", pid));
throw std::runtime_error(fmt::format("Unknown child width pid ({}) died.", pid));
}

const auto module_name = module_iter->second;
Expand Down Expand Up @@ -896,7 +894,7 @@ int boot(const po::variables_map& vm) {
}
} else {
// unknown payload
EVLOG_error << fmt::format("Received unkown command via controller ipc:\n{}\n... ignoring",
EVLOG_error << fmt::format("Received unknown command via controller ipc:\n{}\n... ignoring",
payload.dump(DUMP_INDENT));
}
} else if (msg.status == controller_ipc::MESSAGE_RETURN_STATUS::ERROR) {
Expand Down
9 changes: 6 additions & 3 deletions src/system_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ GetPasswdEntryResult get_passwd_entry(const std::string& user_name) {
return GetPasswdEntryResult("Could not get supplementary groups for user name: " + user_name);
}

return GetPasswdEntryResult(entry->pw_uid, entry->pw_gid,
std::vector<gid_t>(groups.begin(), groups.begin() + ngroups));
// Clang-tidy recommends using `std::span` here instead, which isn't available in C++17.
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
const std::vector<gid_t> user_groups{groups.begin(), groups.begin() + ngroups};
return GetPasswdEntryResult(entry->pw_uid, entry->pw_gid, user_groups);
}
} // namespace

Expand Down Expand Up @@ -137,7 +139,8 @@ std::string set_real_user(const std::string& user_name) {
void SubProcess::send_error_and_exit(const std::string& message) {
assert(pid == 0);

write(fd, message.c_str(), std::min(message.size(), MAX_PIPE_MESSAGE_SIZE - 1));
// There isn't much we can do if writing the error message fails, just exit
[[maybe_unused]] auto _write = write(fd, message.c_str(), std::min(message.size(), MAX_PIPE_MESSAGE_SIZE - 1));
close(fd);
_exit(EXIT_FAILURE);
}
Expand Down