int wordexp_ros()

in aws_common/src/fs_utils/wordexp_ros.cpp [20:33]


int wordexp_ros(const char *words, wordexp_t *pwordexp, int flags) {
  bool should_unset_home = false;
  if (nullptr == getenv("HOME") && nullptr != getenv("ROS_HOME")) {
    // We don't want to change the behavior of anything else so we should unset HOME once we're done.
    should_unset_home = true;
    setenv("HOME", getenv("ROS_HOME"), true);
  }

  int wordexp_result = wordexp(words, pwordexp, flags);
  if (should_unset_home) {
    unsetenv("HOME");
  }
  return wordexp_result;
}