Skip to content

Commit

Permalink
Try to fix a communication problem caused by different permissions un…
Browse files Browse the repository at this point in the history
…der linux
  • Loading branch information
mutouyun committed Dec 1, 2024
1 parent 5e5b347 commit 84bb801
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libipc/platform/posix/shm_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ id_t acquire(char const * name, std::size_t size, unsigned mode) {
flag |= O_CREAT;
break;
}
int fd = ::shm_open(op_name.c_str(), flag, S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH);
int fd = ::shm_open(op_name.c_str(), flag, 0);
if (fd == -1) {
ipc::error("fail shm_open[%d]: %s\n", errno, op_name.c_str());
return nullptr;
}
::fchmod(fd, S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH);
auto ii = mem::alloc<id_info_t>();
ii->fd_ = fd;
ii->size_ = size;
Expand Down

0 comments on commit 84bb801

Please sign in to comment.