From 52c80b1b083666f32f0dd432bca59a3f1a726c3d Mon Sep 17 00:00:00 2001 From: Avril Date: Fri, 4 Jun 2021 18:17:46 +0100 Subject: [PATCH] disable naming of shm fds unless explicitly set flag COW_NAME_SHM --- src/cow.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cow.c b/src/cow.c index 7a16a80..f68052e 100644 --- a/src/cow.c +++ b/src/cow.c @@ -37,10 +37,15 @@ static inline cow_t* box_value(cow_t v) static inline int shm_fd(size_t size) { +#ifdef COW_NAME_SHM _Thread_local static char buffer[12] = {0}; snprintf(buffer, 11, "0x%08lx", size); //fprintf(stderr, "shm_fd_name: '%s'\n", buffer); + // XXX: Not entirely sure how ownership works for the string passed here... Let's not. int fd = memfd_create(buffer, 0); +#else + int fd = memfd_create("cow_create:shm_fd", 0); +#endif if(fd<=0) die("cow_create:shm_fd:memfd_create"); ftruncate(fd, size); return fd;