Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit 6fa5390

Browse files
IvarWithoutBonesandistorm
authored andcommitted
manager: fix a few gcc/clang-tidy/spellchecker lints
Signed-off-by: Ivar Scholten <ivar.scholten@protonmail.com>
1 parent 2e3ab89 commit 6fa5390

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/manager.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
#include <filesystem>
55
#include <fstream>
66
#include <iostream>
7-
#include <list>
87
#include <map>
98
#include <mutex>
10-
#include <thread>
119
#include <unordered_map>
1210

1311
#include <cstdlib>
@@ -368,7 +366,7 @@ std::map<pid_t, std::string> start_modules(ManagerConfig& config, MQTTAbstractio
368366
continue;
369367
}
370368

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

374372
std::vector<std::string> capabilities;
@@ -378,7 +376,7 @@ std::map<pid_t, std::string> start_modules(ManagerConfig& config, MQTTAbstractio
378376
}
379377

380378
if (not capabilities.empty()) {
381-
EVLOG_info << fmt::format("Module {} wants to aquire the following capabilities: {}", module_name,
379+
EVLOG_info << fmt::format("Module {} wants to acquire the following capabilities: {}", module_name,
382380
fmt::join(capabilities.begin(), capabilities.end(), " "));
383381
}
384382

@@ -837,7 +835,7 @@ int boot(const po::variables_map& vm) {
837835

838836
const auto module_iter = module_handles.find(pid);
839837
if (module_iter == module_handles.end()) {
840-
throw std::runtime_error(fmt::format("Unkown child width pid ({}) died.", pid));
838+
throw std::runtime_error(fmt::format("Unknown child width pid ({}) died.", pid));
841839
}
842840

843841
const auto module_name = module_iter->second;
@@ -888,7 +886,7 @@ int boot(const po::variables_map& vm) {
888886
}
889887
} else {
890888
// unknown payload
891-
EVLOG_error << fmt::format("Received unkown command via controller ipc:\n{}\n... ignoring",
889+
EVLOG_error << fmt::format("Received unknown command via controller ipc:\n{}\n... ignoring",
892890
payload.dump(DUMP_INDENT));
893891
}
894892
} else if (msg.status == controller_ipc::MESSAGE_RETURN_STATUS::ERROR) {

src/system_unix.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ GetPasswdEntryResult get_passwd_entry(const std::string& user_name) {
6161
return GetPasswdEntryResult("Could not get supplementary groups for user name: " + user_name);
6262
}
6363

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

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

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

0 commit comments

Comments
 (0)