Skip to content

Commit

Permalink
[eclipse-iceoryx#116] Fix race in shm create or open
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Feb 19, 2024
1 parent dfd44b1 commit 3079544
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Fix `open_or_create` race [#108](https://github.com/eclipse-iceoryx/iceoryx2/issues/108)
* Fix `CreationMode::OpenOrCreate` in `iceoryx2-bb-posix::SharedMemory` [#116](https://github.com/eclipse-iceoryx/iceoryx2/issues/116)
* Fix undefined behavior in `spsc::{queue|index_queue}` [#87](https://github.com/eclipse-iceoryx/iceoryx2/issues/87)

### Refactoring
Expand Down
8 changes: 7 additions & 1 deletion iceoryx2-bb/posix/src/shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,13 @@ impl SharedMemoryCreationBuilder {
}
Err(SharedMemoryCreationError::DoesNotExist) => {
shm_created = true;
SharedMemory::shm_create(&self.config.name, &self.config)?
match SharedMemory::shm_create(&self.config.name, &self.config) {
Ok(fd) => fd,
Err(SharedMemoryCreationError::AlreadyExist) => {
SharedMemory::shm_open(&self.config.name, &self.config)?
}
Err(e) => return Err(e),
}
}
Err(v) => return Err(v),
}
Expand Down

0 comments on commit 3079544

Please sign in to comment.