From 4842eb83b444418ad3fe1901d645dd02224989e5 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 13 Jun 2024 12:20:14 +0000 Subject: [PATCH] helpers: make shm_open() portable after 8bcccf9f0f0f (#6471) https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html https://man.freebsd.org/shm_open/2 https://www.man7.org/linux/man-pages/man3/shm_open.3.html --- src/helpers/MiscFunctions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index b1d734c8..346a3ffa 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -814,7 +814,8 @@ bool envEnabled(const std::string& env) { } std::pair openExclusiveShm() { - std::string name = g_pTokenManager->getRandomUUID(); + // Only absolute paths can be shared across different shm_open() calls + std::string name = "/" + g_pTokenManager->getRandomUUID(); for (size_t i = 0; i < 69; ++i) { int fd = shm_open(name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);