summaryrefslogtreecommitdiffstats
path: root/src/core/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-04-22 20:33:57 +0200
committerLennart Poettering <lennart@poettering.net>2020-04-22 20:33:57 +0200
commit5b99bd5fd4274c5fac86c82a38ca3334e55df543 (patch)
treec91490ebe3f5e1b35a5e67718947c5b6c8bb2d0e /src/core/service.c
parentMerge pull request #15526 from bluca/start_stop_wait_debug (diff)
downloadsystemd-5b99bd5fd4274c5fac86c82a38ca3334e55df543.tar.xz
systemd-5b99bd5fd4274c5fac86c82a38ca3334e55df543.zip
core: some minor clean-ups/modernizations
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 53dbd5509c..861d82041a 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2569,6 +2569,8 @@ static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecC
ExecCommand *first, *c;
assert(s);
+ assert(id >= 0);
+ assert(id < _SERVICE_EXEC_COMMAND_MAX);
first = s->exec_command[id];
@@ -2632,10 +2634,12 @@ static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command
p = cescape(command->path);
if (!p)
- return -ENOMEM;
+ return log_oom();
key = strjoina(type, "-command");
- return serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
+ (void) serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
+
+ return 0;
}
static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
@@ -2737,7 +2741,11 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
return 0;
}
-static int service_deserialize_exec_command(Unit *u, const char *key, const char *value) {
+static int service_deserialize_exec_command(
+ Unit *u,
+ const char *key,
+ const char *value) {
+
Service *s = SERVICE(u);
int r;
unsigned idx = 0, i;