Skip to content

Commit

Permalink
Allow more than one command being skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
gk-tpo authored and rbalint committed Jun 4, 2015
1 parent 638a535 commit 18f5ec0
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/libfaketime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 18f5ec0

Please sign in to comment.