Skip to content

Commit fbacb73

Browse files
committed
fix macos tests
1 parent 20c35cd commit fbacb73

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
A modern C++17 header-only, cross-platform shared memory library.
44

55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
[![Header-only](https://img.shields.io/badge/header--only-yes-brightgreen.svg)](#installation)
7+
[![CI](https://github.com/SlickQuant/slick_shm/actions/workflows/ci.yml/badge.svg)](https://github.com/SlickQuant/slick_shm/actions/workflows/ci.yml)
8+
[![GitHub release](https://img.shields.io/github/v/release/SlickQuant/slick_shm)](https://github.com/SlickQuant/slick_shm/releases)
69

710
## Features
811

include/slick/shm/detail/posix/shared_memory_impl.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class platform_shared_memory {
3737
: shm_fd_(other.shm_fd_),
3838
mapped_addr_(other.mapped_addr_),
3939
name_(std::move(other.name_)),
40+
original_name_(std::move(other.original_name_)),
4041
size_(other.size_),
4142
mode_(other.mode_),
4243
owns_shm_(other.owns_shm_) {
@@ -53,6 +54,7 @@ class platform_shared_memory {
5354
shm_fd_ = other.shm_fd_;
5455
mapped_addr_ = other.mapped_addr_;
5556
name_ = std::move(other.name_);
57+
original_name_ = std::move(other.original_name_);
5658
size_ = other.size_;
5759
mode_ = other.mode_;
5860
owns_shm_ = other.owns_shm_;
@@ -74,7 +76,8 @@ class platform_shared_memory {
7476
return make_error_code(errc::invalid_size);
7577
}
7678

77-
name_ = format_name(name);
79+
original_name_ = name; // Store original name for accessor
80+
name_ = format_name(name); // Store formatted name for POSIX API
7881
size_ = size;
7982
mode_ = access;
8083

@@ -123,7 +126,8 @@ class platform_shared_memory {
123126
return make_error_code(errc::invalid_name);
124127
}
125128

126-
name_ = format_name(name);
129+
original_name_ = name; // Store original name for accessor
130+
name_ = format_name(name); // Store formatted name for POSIX API
127131
mode_ = access;
128132
owns_shm_ = false; // We didn't create it, so don't unlink it
129133

@@ -173,7 +177,7 @@ class platform_shared_memory {
173177
}
174178

175179
const char* name() const noexcept {
176-
return name_.c_str();
180+
return original_name_.c_str();
177181
}
178182

179183
bool is_valid() const noexcept {
@@ -210,7 +214,8 @@ class platform_shared_memory {
210214
private:
211215
int shm_fd_ = -1;
212216
void* mapped_addr_ = nullptr;
213-
std::string name_;
217+
std::string name_; // Formatted name with "/" prefix for POSIX API
218+
std::string original_name_; // Original name without prefix for public accessor
214219
std::size_t size_ = 0;
215220
access_mode mode_ = access_mode::read_write;
216221
bool owns_shm_ = false; // Track if we created it (for unlinking)

0 commit comments

Comments
 (0)