]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/exec-invoke: drop redundant stdio_fdname checks
authorMike Yuan <me@yhndnzj.com>
Wed, 29 Oct 2025 18:39:35 +0000 (19:39 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 30 Oct 2025 15:12:14 +0000 (16:12 +0100)
exec_context_fdname() would never return NULL if corresponding
stdio mode is set to named fd.

src/core/exec-invoke.c

index 27eb8bc53c194d1ba9db456adab4c8a9e4707620..5b0245df33e605d5a3fd90e19e12a15fac78a8e5 100644 (file)
@@ -4765,7 +4765,6 @@ static int exec_context_named_iofds(
         for (size_t i = 0; i < n_fds  && targets > 0; i++)
                 if (named_iofds[STDIN_FILENO] < 0 &&
                     c->std_input == EXEC_INPUT_NAMED_FD &&
-                    stdio_fdname[STDIN_FILENO] &&
                     streq(p->fd_names[i], stdio_fdname[STDIN_FILENO])) {
 
                         named_iofds[STDIN_FILENO] = p->fds[i];
@@ -4773,7 +4772,6 @@ static int exec_context_named_iofds(
 
                 } else if (named_iofds[STDOUT_FILENO] < 0 &&
                            c->std_output == EXEC_OUTPUT_NAMED_FD &&
-                           stdio_fdname[STDOUT_FILENO] &&
                            streq(p->fd_names[i], stdio_fdname[STDOUT_FILENO])) {
 
                         named_iofds[STDOUT_FILENO] = p->fds[i];
@@ -4781,7 +4779,6 @@ static int exec_context_named_iofds(
 
                 } else if (named_iofds[STDERR_FILENO] < 0 &&
                            c->std_error == EXEC_OUTPUT_NAMED_FD &&
-                           stdio_fdname[STDERR_FILENO] &&
                            streq(p->fd_names[i], stdio_fdname[STDERR_FILENO])) {
 
                         named_iofds[STDERR_FILENO] = p->fds[i];