posix shm open 失败时如果文件不存在打印log

This commit is contained in:
Aengus.Jiang 2025-03-07 11:57:31 +08:00
parent d69093462a
commit 5c36b1264f

View File

@ -72,7 +72,8 @@ id_t acquire(char const * name, std::size_t size, unsigned mode) {
S_IRGRP | S_IWGRP | S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH); S_IROTH | S_IWOTH);
if (fd == -1) { if (fd == -1) {
if (open != mode) { // 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()); ipc::error("fail shm_open[%d]: %s\n", errno, op_name.c_str());
} }
return nullptr; return nullptr;