From f540eddb74580d41359e9d147897b7585cfd7e2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 Jan 2025 08:11:02 +0100 Subject: [PATCH] Creating /dev/shm if its not existing, otherwise haveged fails to start. Signed-off-by: Daniel Baumann --- src/haveged.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/haveged.c b/src/haveged.c index c68e510..b9c4827 100644 --- a/src/haveged.c +++ b/src/haveged.c @@ -490,6 +490,12 @@ int main(int argc, char **argv) } } /* Initilize named semaphore to synchronize command instances */ + if (mkdir("/dev/shm", 0755) != 0) { + if (errno != EEXIST) { + error_exit("Couldn't create /dev/shm directory: %s", strerror(errno)); + } + } + sem = sem_open(SEM_NAME, O_CREAT, 0644, 1); if (sem == NULL) { fprintf(stderr, "Warning: Couldn't create named semaphore " SEM_NAME" error: %s", strerror(errno));