Only prepend exec if command line doesn't contain ;&|()
This commit is contained in:
parent
0384c2abd7
commit
e9901e30a2
@ -1,4 +1,4 @@
|
|||||||
.Dd August 16, 2020
|
.Dd March 1, 2021
|
||||||
.Dt CATSIT.CONF 5
|
.Dt CATSIT.CONF 5
|
||||||
.Os
|
.Os
|
||||||
.
|
.
|
||||||
@ -46,6 +46,12 @@ is executed using the shell.
|
|||||||
The shell variable
|
The shell variable
|
||||||
.Va $0
|
.Va $0
|
||||||
is set to the name of the service.
|
is set to the name of the service.
|
||||||
|
If the command line
|
||||||
|
does not contain the characters
|
||||||
|
.Ql ;&|()
|
||||||
|
it is prepended by
|
||||||
|
.Ic exec
|
||||||
|
when passed to the shell.
|
||||||
.
|
.
|
||||||
.It Ar @service Ar command ...
|
.It Ar @service Ar command ...
|
||||||
Service names beginning with
|
Service names beginning with
|
||||||
|
@ -246,7 +246,9 @@ void serviceStart(struct Service *service) {
|
|||||||
if (len >= sizeof(command)) errx(ExitNoExec, "command truncated");
|
if (len >= sizeof(command)) errx(ExitNoExec, "command truncated");
|
||||||
}
|
}
|
||||||
int n = snprintf(
|
int n = snprintf(
|
||||||
&command[len], sizeof(command) - len, "exec %s", service->command
|
&command[len], sizeof(command) - len, "%s%s",
|
||||||
|
(service->command[strcspn(service->command, ";&|()")] ? "exec " : ""),
|
||||||
|
service->command
|
||||||
);
|
);
|
||||||
assert(n > 0);
|
assert(n > 0);
|
||||||
len += n;
|
len += n;
|
||||||
|
Loading…
Reference in New Issue
Block a user