about summary refs log tree commit diff
path: root/service.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-03-01 19:29:27 -0500
committerJune McEnroe <june@causal.agency>2021-03-01 19:29:27 -0500
commite9901e30a2f1bf52aee83359a318f7314131f816 (patch)
tree242e80854a7c724f1dca7620dca8d750ff6ced19 /service.c
parentExit with EX_TEMPFAIL when watching files (diff)
downloadcatsit-e9901e30a2f1bf52aee83359a318f7314131f816.tar.gz
catsit-e9901e30a2f1bf52aee83359a318f7314131f816.zip
Only prepend exec if command line doesn't contain ;&|()
Diffstat (limited to '')
-rw-r--r--service.c4
1 files changed, 3 insertions, 1 deletions
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;