diff --git a/src/manager.cpp b/src/manager.cpp index 466d7974..719ceb03 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -4,10 +4,8 @@ #include #include #include -#include #include #include -#include #include #include @@ -376,7 +374,7 @@ std::map 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 capabilities; @@ -386,7 +384,7 @@ std::map 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(), " ")); } @@ -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; @@ -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) { diff --git a/src/system_unix.cpp b/src/system_unix.cpp index 7335b824..2c984881 100644 --- a/src/system_unix.cpp +++ b/src/system_unix.cpp @@ -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(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 user_groups{groups.begin(), groups.begin() + ngroups}; + return GetPasswdEntryResult(entry->pw_uid, entry->pw_gid, user_groups); } } // namespace @@ -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); }