summaryrefslogtreecommitdiff
path: root/src/helpers/MiscFunctions.cpp
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2024-06-13 12:20:14 +0000
committerGitHub <noreply@github.com>2024-06-13 14:20:14 +0200
commit4842eb83b444418ad3fe1901d645dd02224989e5 (patch)
treed903a659245b234e30df658f544b0ac7e7cdb795 /src/helpers/MiscFunctions.cpp
parente6d10539af1fdca33b10bc3c1dfac16f1cdfe1c8 (diff)
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
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
-rw-r--r--src/helpers/MiscFunctions.cpp3
1 files changed, 2 insertions, 1 deletions
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<int, std::string> 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);