Skip to content

Commit

Permalink
Set FAKETIME_FLSHM=1 to auto-unset FAKETIME_SHARED (addresses wolfcw#427
Browse files Browse the repository at this point in the history
)
  • Loading branch information
wolfcw committed Jun 8, 2023
1 parent 0c2e3d4 commit 7154a3f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libfaketime.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ static void ft_shm_init (void)
char sem_name[256], shm_name[256], *ft_shared_env = getenv("FAKETIME_SHARED");
sem_t *shared_semR = NULL;
static int nt=1;
static int ft_shm_initialized = 0;

/* do all of this once only */
if (ft_shm_initialized > 0) return;

/* create semaphore and shared memory locally unless it has been passed along */
if (ft_shared_env == NULL)
Expand Down Expand Up @@ -595,6 +599,12 @@ static void ft_shm_init (void)
exit(1);
}
}
if (getenv("FAKETIME_FLSHM") != NULL)
{ /* force the deletion of the shm sync env variable */
unsetenv("FAKETIME_SHARED");
}

ft_shm_initialized = 1;
}

static void ft_cleanup (void)
Expand Down

0 comments on commit 7154a3f

Please sign in to comment.