diff options
author | June McEnroe <june@causal.agency> | 2021-03-01 19:29:27 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-03-01 19:29:27 -0500 |
commit | e9901e30a2f1bf52aee83359a318f7314131f816 (patch) | |
tree | 242e80854a7c724f1dca7620dca8d750ff6ced19 | |
parent | Exit with EX_TEMPFAIL when watching files (diff) | |
download | catsit-e9901e30a2f1bf52aee83359a318f7314131f816.tar.gz catsit-e9901e30a2f1bf52aee83359a318f7314131f816.zip |
Only prepend exec if command line doesn't contain ;&|()
Diffstat (limited to '')
-rw-r--r-- | catsit.conf.5 | 8 | ||||
-rw-r--r-- | service.c | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/catsit.conf.5 b/catsit.conf.5 index ccac76d..b7a45d4 100644 --- a/catsit.conf.5 +++ b/catsit.conf.5 @@ -1,4 +1,4 @@ -.Dd August 16, 2020 +.Dd March 1, 2021 .Dt CATSIT.CONF 5 .Os . @@ -46,6 +46,12 @@ is executed using the shell. The shell variable .Va $0 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 ... Service names beginning with diff --git a/service.c b/service.c index 4ea9126..38049ff 100644 --- a/service.c +++ b/service.c @@ -246,7 +246,9 @@ void serviceStart(struct Service *service) { if (len >= sizeof(command)) errx(ExitNoExec, "command truncated"); } 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); len += n; |