diff --git a/ebpfdiscoverysrv/src/main.cpp b/ebpfdiscoverysrv/src/main.cpp index cdd21f96..56cc0a0b 100644 --- a/ebpfdiscoverysrv/src/main.cpp +++ b/ebpfdiscoverysrv/src/main.cpp @@ -70,7 +70,7 @@ static void runUnixSignalHandlerLoop() { while (true) { sigset_t sigset{getSigset()}; LOG_TRACE("Waiting for unix signals."); - int signo{sigwaitinfo(&sigset, nullptr)}; + const auto signo{sigwaitinfo(&sigset, nullptr)}; if (signo == -1) { LOG_CRITICAL("Failed to wait for unix signals: {}", std::strerror(errno)); std::abort(); diff --git a/libebpfdiscovery/src/DiscoveryBpfLoader.cpp b/libebpfdiscovery/src/DiscoveryBpfLoader.cpp index 8fba5a12..6950d79e 100644 --- a/libebpfdiscovery/src/DiscoveryBpfLoader.cpp +++ b/libebpfdiscovery/src/DiscoveryBpfLoader.cpp @@ -21,7 +21,7 @@ void DiscoveryBpfLoader::load() { LIBBPF_OPTS(bpf_object_open_opts, newOpenOpts); openOpts = newOpenOpts; - if (int res{ensure_core_btf(&openOpts)}) { + if (const auto res{ensure_core_btf(&openOpts)}) { throw std::runtime_error("Failed to fetch necessary BTF for CO-RE: " + std::string(strerror(-res))); } @@ -30,11 +30,11 @@ void DiscoveryBpfLoader::load() { throw std::runtime_error("Failed to open BPF object."); } - if (int res{discovery_bpf__load(skel)}) { + if (const auto res{discovery_bpf__load(skel)}) { throw std::runtime_error("Failed to load BPF object: " + std::to_string(res)); } - if (int res{discovery_bpf__attach(skel)}) { + if (const auto res{discovery_bpf__attach(skel)}) { throw std::runtime_error("Failed to attach BPF object: " + std::to_string(res)); }