From e90e2684559e207a8cdb2251db12a6154f2f4e19 Mon Sep 17 00:00:00 2001 From: Simon Hoinkis Date: Sat, 16 Sep 2023 18:48:06 +0200 Subject: [PATCH] Use 'rcutils_get_executable_name' to get the name of the process (#94) Signed-off-by: Simon Hoinkis --- rmw_iceoryx_cpp/src/rmw_init.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rmw_iceoryx_cpp/src/rmw_init.cpp b/rmw_iceoryx_cpp/src/rmw_init.cpp index 7704085..f8bf2e7 100644 --- a/rmw_iceoryx_cpp/src/rmw_init.cpp +++ b/rmw_iceoryx_cpp/src/rmw_init.cpp @@ -19,6 +19,7 @@ #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "rcutils/error_handling.h" +#include "rcutils/process.h" #include "rmw/error_handling.h" #include "rmw/impl/cpp/macros.hpp" @@ -95,8 +96,9 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context) context->impl = nullptr; // create a name for the process to register with the RouDi daemon - extern char * __progname; - auto progName = std::string(__progname); + rcutils_allocator_t allocator = rcutils_get_default_allocator(); + auto progam_name = rcutils_get_executable_name(allocator); + auto progName = std::string(progam_name); /// @todo we could check with the introspection topics beforehand if the name is already used auto name = progName + "_" + std::to_string(getpid());