From 3429431a688578a279a9fa6b01caae4eba94bc66 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Wed, 18 Sep 2024 12:54:17 +0200 Subject: [PATCH] Apply some missing formatting and unreachable code --- collector/lib/CollectorStats.h | 2 +- collector/lib/DuplexGRPC.h | 3 +-- collector/lib/ProcfsScraper.cpp | 3 +-- collector/lib/SignalServiceClient.cpp | 3 +-- collector/lib/SignalServiceClient.h | 4 ++-- collector/test/HostHeuristicsTest.cpp | 2 +- integration-tests/container/perf/scripts/init.sh | 10 +++++----- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/collector/lib/CollectorStats.h b/collector/lib/CollectorStats.h index 1b7c46de84d..5c8f3d230d5 100644 --- a/collector/lib/CollectorStats.h +++ b/collector/lib/CollectorStats.h @@ -90,7 +90,7 @@ class CollectorStats { std::array, counter_type_max> counter_ = {{}}; - CollectorStats(){}; + CollectorStats() {}; }; template diff --git a/collector/lib/DuplexGRPC.h b/collector/lib/DuplexGRPC.h index 425488328f4..22e0efb8b37 100644 --- a/collector/lib/DuplexGRPC.h +++ b/collector/lib/DuplexGRPC.h @@ -550,8 +550,7 @@ class DuplexClientReaderWriter : public DuplexClientWriter { // Shutdown the client and drain the queue. this->Shutdown(); // ignore errors auto now = ToDeadline(time_point::min()); - while (ProcessSingle(nullptr, now, nullptr)) - ; + while (ProcessSingle(nullptr, now, nullptr)); } template diff --git a/collector/lib/ProcfsScraper.cpp b/collector/lib/ProcfsScraper.cpp index b7b075c93b0..f02f086d7c4 100644 --- a/collector/lib/ProcfsScraper.cpp +++ b/collector/lib/ProcfsScraper.cpp @@ -44,8 +44,7 @@ const char* nextfield(const char* p, const char* endp) { while (p < endp && *p && !std::isspace(*p)) { p++; } - while (p < endp && *p && std::isspace(*++p)) - ; + while (p < endp && *p && std::isspace(*++p)); return (p < endp && *p) ? p : nullptr; } diff --git a/collector/lib/SignalServiceClient.cpp b/collector/lib/SignalServiceClient.cpp index 3034ce31594..b0676cc6a75 100644 --- a/collector/lib/SignalServiceClient.cpp +++ b/collector/lib/SignalServiceClient.cpp @@ -43,8 +43,7 @@ bool SignalServiceClient::EstablishGRPCStreamSingle() { } void SignalServiceClient::EstablishGRPCStream() { - while (EstablishGRPCStreamSingle()) - ; + while (EstablishGRPCStreamSingle()); CLOG(INFO) << "Signal service client terminating."; } diff --git a/collector/lib/SignalServiceClient.h b/collector/lib/SignalServiceClient.h index 49f8b97c2a6..668989f6096 100644 --- a/collector/lib/SignalServiceClient.h +++ b/collector/lib/SignalServiceClient.h @@ -66,8 +66,8 @@ class StdoutSignalServiceClient : public ISignalServiceClient { explicit StdoutSignalServiceClient() {} - void Start(){}; - void Stop(){}; + void Start() {}; + void Stop() {}; SignalHandler::Result PushSignals(const SignalStreamMessage& msg); }; diff --git a/collector/test/HostHeuristicsTest.cpp b/collector/test/HostHeuristicsTest.cpp index 6f66f03ef50..dfa737652fb 100644 --- a/collector/test/HostHeuristicsTest.cpp +++ b/collector/test/HostHeuristicsTest.cpp @@ -51,7 +51,7 @@ class MockHostInfoHeuristics : public HostInfo { class MockCollectorConfig : public CollectorConfig { public: MockCollectorConfig() - : CollectorConfig(){}; + : CollectorConfig() {}; void SetCollectionMethod(CollectionMethod cm) { if (host_config_.HasCollectionMethod()) { diff --git a/integration-tests/container/perf/scripts/init.sh b/integration-tests/container/perf/scripts/init.sh index e22cfaf9d2b..2c0f27f1ea4 100755 --- a/integration-tests/container/perf/scripts/init.sh +++ b/integration-tests/container/perf/scripts/init.sh @@ -123,6 +123,11 @@ check_headers() { return 0 } +if [[ "$(sysctl -n kernel.kptr_restrict)" != "0" ]]; then + # If this is not zero, it can interfere with most of the tools + sysctl -w kernel.kptr_restrict=0 +fi + if [[ ! -e "/lib/modules/.installed" ]]; then if check_headers "${HOST_MODULES_DIR}"; then HEADERS_TARGET="${HOST_MODULES_DIR}/source" @@ -139,8 +144,3 @@ else echo "Headers already installed" exit 0 fi - -if [[ "$(sysctl -n kernel.kptr_restrict)" != "0" ]]; then - # If this is not zero, it can interfere with most of the tools - sysctl -w kernel.kptr_restrict=0 -fi