summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-03-01 19:41:01 -0500
committerJune McEnroe <june@causal.agency>2021-03-01 19:41:01 -0500
commit207da7ffcf52352cf71090cd7e4e7881816618f1 (patch)
treeaa9f4dc6dc9b3a9713a8887368f161efc3a9bed1
parentOnly prepend exec if command line doesn't contain ;&|() (diff)
downloadcatsit-207da7ffcf52352cf71090cd7e4e7881816618f1.tar.gz
catsit-207da7ffcf52352cf71090cd7e4e7881816618f1.zip
Skip leading whitespace on prepends and commands 1.3
-rw-r--r--daemon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/daemon.c b/daemon.c
index f36e277..1bab9ef 100644
--- a/daemon.c
+++ b/daemon.c
@@ -70,7 +70,8 @@ static int parseConfig(const char *path) {
 		if (!ptr[0] || ptr[0] == '#') {
 			continue;
 		} else if (ptr[0] == '%') {
-			int error = prependAdd(&ptr[1]);
+			ptr++;
+			int error = prependAdd(&ptr[strspn(ptr, WS)]);
 			if (error) {
 				syslog(LOG_WARNING, "cannot add prepend command: %m");
 				goto err;
@@ -84,7 +85,7 @@ static int parseConfig(const char *path) {
 				);
 				goto err;
 			}
-			int error = serviceAdd(name, ptr);
+			int error = serviceAdd(name, &ptr[strspn(ptr, WS)]);
 			if (error) {
 				syslog(LOG_WARNING, "cannot add service: %m");
 				goto err;