]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: some minor clean-ups/modernizations
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Apr 2020 18:33:57 +0000 (20:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Apr 2020 18:33:57 +0000 (20:33 +0200)
src/core/service.c

index 53dbd5509ce717694af7f0ab8ff3e3ffaab40ce2..861d82041a65d51c04f4290b9d5133edf1de767a 100644 (file)
@@ -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;