]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: drop duplicate ExecCommand check
authorMike Yuan <me@yhndnzj.com>
Mon, 5 May 2025 20:12:09 +0000 (22:12 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 6 May 2025 14:13:16 +0000 (16:13 +0200)
It is verified in config_parse_exec() and bus_set_transient_exec_command()
already.

src/core/service.c

index 278d93272ae9570897f176a6fecb15e15097d94c..a3e50788dfcaf81c3aa10144801791e6acb5631b 100644 (file)
@@ -672,25 +672,11 @@ static int service_verify(Service *s) {
         assert(s);
         assert(UNIT(s)->load_state == UNIT_LOADED);
 
-        for (ServiceExecCommand c = 0; c < _SERVICE_EXEC_COMMAND_MAX; c++)
-                LIST_FOREACH(command, command, s->exec_command[c]) {
-                        if (!path_is_absolute(command->path) && !filename_is_valid(command->path))
-                                return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC),
-                                                            "Service %s= binary path \"%s\" is neither a valid executable name nor an absolute path. Refusing.",
-                                                            command->path,
-                                                            service_exec_command_to_string(c));
-                        if (strv_isempty(command->argv))
-                                return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC),
-                                                            "Service has an empty argv in %s=. Refusing.",
-                                                            service_exec_command_to_string(c));
-                }
-
         if (!s->exec_command[SERVICE_EXEC_START] && !s->exec_command[SERVICE_EXEC_STOP] &&
             UNIT(s)->success_action == EMERGENCY_ACTION_NONE)
                 /* FailureAction= only makes sense if one of the start or stop commands is specified.
                  * SuccessAction= will be executed unconditionally if no commands are specified. Hence,
                  * either a command or SuccessAction= are required. */
-
                 return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC), "Service has no ExecStart=, ExecStop=, or SuccessAction=. Refusing.");
 
         if (s->type != SERVICE_ONESHOT && !s->exec_command[SERVICE_EXEC_START])