about summary refs log tree commit diff
path: root/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'service.c')
-rw-r--r--service.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/service.c b/service.c
index 38049ff..2406175 100644
--- a/service.c
+++ b/service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2020  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -82,7 +82,7 @@ int serviceAdd(const char *name, const char *command) {
 
 	if (services.len == services.cap) {
 		size_t cap = (services.cap ? services.cap * 2 : 8);
-		void *ptr = realloc(services.ptr, sizeof(*services.ptr) * cap);
+		void *ptr = reallocarray(services.ptr, cap, sizeof(*services.ptr));
 		if (!ptr) return -1;
 		services.cap = cap;
 		services.ptr = ptr;
@@ -247,7 +247,7 @@ void serviceStart(struct Service *service) {
 	}
 	int n = snprintf(
 		&command[len], sizeof(command) - len, "%s%s",
-		(service->command[strcspn(service->command, ";&|()")] ? "exec " : ""),
+		(service->command[strcspn(service->command, ";&|()")] ? "" : "exec "),
 		service->command
 	);
 	assert(n > 0);