Skip to content

Commit 4936431

Browse files
Use 'rcutils_get_executable_name' to get the name of the process (#94) (#97)
Signed-off-by: Simon Hoinkis <[email protected]>
1 parent 6567d29 commit 4936431

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rmw_iceoryx_cpp/src/rmw_init.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "iceoryx_posh/runtime/posh_runtime.hpp"
2020

2121
#include "rcutils/error_handling.h"
22+
#include "rcutils/process.h"
2223

2324
#include "rmw/error_handling.h"
2425
#include "rmw/impl/cpp/macros.hpp"
@@ -95,8 +96,9 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
9596
context->impl = nullptr;
9697

9798
// create a name for the process to register with the RouDi daemon
98-
extern char * __progname;
99-
auto progName = std::string(__progname);
99+
rcutils_allocator_t allocator = rcutils_get_default_allocator();
100+
auto progam_name = rcutils_get_executable_name(allocator);
101+
auto progName = std::string(progam_name);
100102
/// @todo we could check with the introspection topics beforehand if the name is already used
101103
auto name = progName + "_" + std::to_string(getpid());
102104

0 commit comments

Comments
 (0)