mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 08:36:28 +03:00
Allow more than one command being skipped
This commit is contained in:
committed by
Balint Reczey
parent
638a535b5f
commit
18f5ec0671
@@ -1662,17 +1662,29 @@ void ftpl_init(void)
|
||||
/* We can prevent faking time for specified commands */
|
||||
if ((tmp_env = getenv("FAKETIME_SKIP_CMDS")) != NULL)
|
||||
{
|
||||
char *skip_cmd, *saveptr;
|
||||
skip_cmd = strtok_r(tmp_env, ",", &saveptr);
|
||||
while (skip_cmd != NULL)
|
||||
char *skip_cmd, *saveptr, *tmpvar;
|
||||
/* Don't mess with the env variable directly. */
|
||||
tmpvar = strdup(tmp_env);
|
||||
if (tmpvar != NULL)
|
||||
{
|
||||
if (0 == strcmp(progname, skip_cmd))
|
||||
skip_cmd = strtok_r(tmpvar, ",", &saveptr);
|
||||
while (skip_cmd != NULL)
|
||||
{
|
||||
ft_mode = FT_NOOP;
|
||||
dont_fake = true;
|
||||
break;
|
||||
if (0 == strcmp(progname, skip_cmd))
|
||||
{
|
||||
ft_mode = FT_NOOP;
|
||||
dont_fake = true;
|
||||
break;
|
||||
}
|
||||
skip_cmd = strtok_r(NULL, ",", &saveptr);
|
||||
}
|
||||
skip_cmd = strtok_r(NULL, ",", &saveptr);
|
||||
free(tmpvar);
|
||||
tmpvar = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Error: Could not copy the environment variable value.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user