Skip to content

Commit

Permalink
iox-#2330 Refactor call to iox_getenv_s for type safety (rev.2)
Browse files Browse the repository at this point in the history
Cast `info.total_size` to unsigned int in the `iox_getenv_s` call to ensure type matching and eliminate potential issues with type mismatches. This change improves code robustness and ensures adherence to function signature requirements.
  • Loading branch information
khromenokroman committed Aug 29, 2024
1 parent 20793f5 commit ef310cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions iceoryx_posh/source/roudi/roudi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,7 @@ 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, static_cast<unsigned int>(info.total_size), env_var)
auto result = IOX_POSIX_CALL(iox_getenv_s)(&actualSizeWithNull, buffer, info.total_size, env_var)
.failureReturnValue(-1)
.evaluate();

Expand Down

0 comments on commit ef310cb

Please sign in to comment.