Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/libipc/platform/posix/shm_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ id_t acquire(char const * name, std::size_t size, unsigned mode) {
S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH);
if (fd == -1) {
ipc::error("fail shm_open[%d]: %s\n", errno, op_name.c_str());
// only open shm not log error when file not exist
if (open != mode || ENOENT != errno) {
ipc::error("fail shm_open[%d]: %s\n", errno, op_name.c_str());
}
return nullptr;
}
::fchmod(fd, S_IRUSR | S_IWUSR |
Expand Down
6 changes: 5 additions & 1 deletion src/libipc/shm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ bool handle::acquire(char const * name, std::size_t size, unsigned mode) {
return false;
}
release();
const auto id = shm::acquire(name, size, mode);
if (!id) {
return false;
}
impl(p_)->id_ = id;
impl(p_)->n_ = name;
impl(p_)->id_ = shm::acquire(name, size, mode);
impl(p_)->m_ = shm::get_mem(impl(p_)->id_, &(impl(p_)->s_));
return valid();
}
Expand Down