fix: Expand undefined vars to empty string
Bugs (fixed):
* Md shared memory file names have unexpanded variable: '${BTS_SHARED_MEMORY_PREFIX}'
This commit is contained in:
1 parent
5e62b42404
commit
8cd2bb3d49
2 files changed
+2
-1
No files matched your search
@@ -15,7 +15,7 @@ std::string ShmSegmentName::prefix() {
|
||||
std::lock_guard<std::mutex> lock{prefix_mx_};
|
||||
// Verify it hasn't been initialized again (since the initial check was done without a lock).
|
||||
if (!prefix_initialized_) {
|
||||
os::try_expand_env(SHARED_MEMORY_PREFIX, prefix_);
|
||||
prefix_ = os::expand_env(SHARED_MEMORY_PREFIX, false);
|
||||
auto proc_name = os::process_path().filename().string();
|
||||
if (prefix_.empty()) {
|
||||
prefix_ = std::move(proc_name);
|
||||
|
||||
@@ -668,6 +668,7 @@ std::string expand_env(std::string name, bool assert_vars_exist) {
|
||||
bts_assert_msgf(
|
||||
!assert_vars_exist, "Environment variable '{}' is undefined",
|
||||
std::string{name});
|
||||
name.replace(from.first, from.second, "");
|
||||
continue;
|
||||
}
|
||||
name.replace(from.first, from.second, var);
|
||||
|
||||
Reference in new issue
Block a user