Skip to content

Commit

Permalink
ensure proper truncation of empty space after hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Aug 31, 2021
1 parent fabaa77 commit 880f187
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/common/hostname.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace common
// additional dependency.
inline auto hostname() -> std::string
{
std::string name(256, '\0');
::gethostname(name.data(), 256);
char name[256];
::gethostname(name, 256);
return name;
}
} // namespace common

0 comments on commit 880f187

Please sign in to comment.