Skip to content

Commit

Permalink
iox-#2330 Refactor environment variable fetching in roudi
Browse files Browse the repository at this point in the history
Update the call to iox_getenv_s casting for info.total_size
  • Loading branch information
khromenokroman committed Sep 1, 2024
1 parent a5f4534 commit 11eb857
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions iceoryx_posh/source/roudi/roudi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,10 @@ std::string ServiceManagementSystemd::getEnvironmentVariable(const char* const e

str.unsafe_raw_access([&](auto* buffer, auto const info) {
size_t actualSizeWithNull{0};
auto result = IOX_POSIX_CALL(iox_getenv_s)(&actualSizeWithNull, buffer, info.total_size, env_var)
.failureReturnValue(-1)
.evaluate();
auto result =
IOX_POSIX_CALL(iox_getenv_s)(&actualSizeWithNull, buffer, static_cast<size_t>(info.total_size), env_var)
.failureReturnValue(-1)
.evaluate();

if (result.has_error() && result.error().errnum == ERANGE)
{
Expand Down

0 comments on commit 11eb857

Please sign in to comment.