Add a --no-startup-id flag for exec (command), exec (config), exec_always (config)

This commit is contained in:
Michael Stapelberg
2011-10-25 22:18:17 +01:00
parent 726f2a1e5a
commit bbfbd28dfa
6 changed files with 89 additions and 45 deletions

View File

@ -1507,8 +1507,19 @@ restart_state:
exec:
TOKEXEC STR
{
char *command = $2;
bool no_startup_id = false;
if (strncasecmp($2, "--no-startup-id ", strlen("--no-startup-id ")) == 0) {
no_startup_id = true;
/* We need to make a copy here, otherwise we leak the
* --no-startup-id bytes in the beginning of the string */
command = sstrdup(command + strlen("--no-startup-id "));
free($2);
}
struct Autostart *new = smalloc(sizeof(struct Autostart));
new->command = $2;
new->command = command;
new->no_startup_id = no_startup_id;
TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
}
;
@ -1516,8 +1527,19 @@ exec:
exec_always:
TOKEXEC_ALWAYS STR
{
char *command = $2;
bool no_startup_id = false;
if (strncasecmp($2, "--no-startup-id ", strlen("--no-startup-id ")) == 0) {
no_startup_id = true;
/* We need to make a copy here, otherwise we leak the
* --no-startup-id bytes in the beginning of the string */
command = sstrdup(command + strlen("--no-startup-id "));
free($2);
}
struct Autostart *new = smalloc(sizeof(struct Autostart));
new->command = $2;
new->command = command;
new->no_startup_id = no_startup_id;
TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
}
;