From ab248238393bc3a9d78c4e157a980d32f24a0efa Mon Sep 17 00:00:00 2001 From: Damien Mehala Date: Thu, 10 Oct 2024 10:25:40 -0400 Subject: [PATCH 1/2] fix: compilation issue for getting the process name Resolves #162 --- src/datadog/platform_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datadog/platform_util.cpp b/src/datadog/platform_util.cpp index a270686b..79f00143 100644 --- a/src/datadog/platform_util.cpp +++ b/src/datadog/platform_util.cpp @@ -98,7 +98,7 @@ std::tuple get_windows_info() { // application manifest, which is the lowest version supported by the // application. Use `RtlGetVersion` to obtain the accurate OS version // regardless of the manifest. - using RtlGetVersion = auto(*)(LPOSVERSIONINFOEXW)->NTSTATUS; + using RtlGetVersion = auto (*)(LPOSVERSIONINFOEXW)->NTSTATUS; RtlGetVersion func = (RtlGetVersion)GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); @@ -191,7 +191,7 @@ int get_process_id() { std::string get_process_name() { #if defined(__APPLE__) || defined(__FreeBSD__) - char* process_name = getprogname(); + const char* process_name = getprogname(); return (process_name != nullptr) ? process_name : "unknown-service"; #elif defined(__linux__) || defined(__unix__) return program_invocation_short_name; From 5b5ead17f10b98330cf1dfc6958c6dccf90a763a Mon Sep 17 00:00:00 2001 From: Damien Mehala Date: Fri, 11 Oct 2024 10:49:03 -0400 Subject: [PATCH 2/2] Apply suggestions from code review --- src/datadog/platform_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadog/platform_util.cpp b/src/datadog/platform_util.cpp index 79f00143..f395d7cf 100644 --- a/src/datadog/platform_util.cpp +++ b/src/datadog/platform_util.cpp @@ -98,7 +98,7 @@ std::tuple get_windows_info() { // application manifest, which is the lowest version supported by the // application. Use `RtlGetVersion` to obtain the accurate OS version // regardless of the manifest. - using RtlGetVersion = auto (*)(LPOSVERSIONINFOEXW)->NTSTATUS; + using RtlGetVersion = auto(*)(LPOSVERSIONINFOEXW)->NTSTATUS; RtlGetVersion func = (RtlGetVersion)GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");