]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: drop "argv" field from ExecParameter structure
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Jul 2018 16:47:32 +0000 (18:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 23 Jul 2018 11:36:47 +0000 (13:36 +0200)
We always initialize it from the same field in ExecCommand anyway, hence
there's no point in passing it separately to exec_spawn(), after all we
already pass the ExecCommand structure itself anyway.

No change in behaviour.

src/core/execute.c
src/core/execute.h
src/core/service.c
src/core/socket.c

index ed735a7660032a877bb362716ff62b322b370839..80736abbfd5695148fd206ed2be1565b9000ff91 100644 (file)
@@ -2721,7 +2721,6 @@ static int exec_child(
                 const ExecParameters *params,
                 ExecRuntime *runtime,
                 DynamicCreds *dcreds,
-                char **argv,
                 int socket_fd,
                 int named_iofds[3],
                 int *fds,
@@ -2817,7 +2816,7 @@ static int exec_child(
                 const char *vc = params->confirm_spawn;
                 _cleanup_free_ char *cmdline = NULL;
 
-                cmdline = exec_command_line(argv);
+                cmdline = exec_command_line(command->argv);
                 if (!cmdline) {
                         *exit_status = EXIT_MEMORY;
                         return log_oom();
@@ -3396,7 +3395,7 @@ static int exec_child(
                 strv_free_and_replace(accum_env, ee);
         }
 
-        final_argv = replace_env_argv(argv, accum_env);
+        final_argv = replace_env_argv(command->argv, accum_env);
         if (!final_argv) {
                 *exit_status = EXIT_MEMORY;
                 return log_oom();
@@ -3442,13 +3441,10 @@ int exec_spawn(Unit *unit,
                DynamicCreds *dcreds,
                pid_t *ret) {
 
+        int socket_fd, r, named_iofds[3] = { -1, -1, -1 }, *fds = NULL;
         _cleanup_strv_free_ char **files_env = NULL;
-        int *fds = NULL;
         size_t n_storage_fds = 0, n_socket_fds = 0;
         _cleanup_free_ char *line = NULL;
-        int socket_fd, r;
-        int named_iofds[3] = { -1, -1, -1 };
-        char **argv;
         pid_t pid;
 
         assert(unit);
@@ -3488,8 +3484,7 @@ int exec_spawn(Unit *unit,
         if (r < 0)
                 return log_unit_error_errno(unit, r, "Failed to load environment files: %m");
 
-        argv = params->argv ?: command->argv;
-        line = exec_command_line(argv);
+        line = exec_command_line(command->argv);
         if (!line)
                 return log_oom();
 
@@ -3512,7 +3507,6 @@ int exec_spawn(Unit *unit,
                                params,
                                runtime,
                                dcreds,
-                               argv,
                                socket_fd,
                                named_iofds,
                                fds,
@@ -3662,7 +3656,6 @@ static void exec_command_done(ExecCommand *c) {
         assert(c);
 
         c->path = mfree(c->path);
-
         c->argv = strv_free(c->argv);
 }
 
index de44085492fdd4293295e669aeb10697264dbe68..81a118c5cd912081fe61fd4b460d01b11cc25e6b 100644 (file)
@@ -292,7 +292,6 @@ typedef enum ExecFlags {
 } ExecFlags;
 
 struct ExecParameters {
-        char **argv;
         char **environment;
 
         int *fds;
index db1356c4173483bfb400a9693de07c281a9ed6c0..872bb7752656544faf729bf12657584bb49436fd 100644 (file)
@@ -1446,7 +1446,6 @@ static int service_spawn(
         SET_FLAG(exec_params.flags, EXEC_NSS_BYPASS_BUS,
                  MANAGER_IS_SYSTEM(UNIT(s)->manager) && unit_has_name(UNIT(s), SPECIAL_DBUS_SERVICE));
 
-        exec_params.argv = c->argv;
         exec_params.environment = final_env;
         exec_params.fds = fds;
         exec_params.fd_names = fd_names;
index 56d32225c48f1021b74a18da093e32896bc4834b..1bd32cf2504c0d00422c10dc24b6c323dbe7f6ef 100644 (file)
@@ -1889,8 +1889,6 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
 
         unit_set_exec_params(UNIT(s), &exec_params);
 
-        exec_params.argv = c->argv;
-
         r = exec_spawn(UNIT(s),
                        c,
                        &s->exec_context,