Skip to content

Commit

Permalink
Creating /dev/shm if its not existing, otherwise haveged fails to start.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Baumann <[email protected]>
  • Loading branch information
daniel-baumann committed Jan 18, 2025
1 parent 6dcc0bb commit f540edd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/haveged.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f540edd

Please sign in to comment.