]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/exec-invoke: remove redundant accmode validation on stderr 39860/head
authorMike Yuan <me@yhndnzj.com>
Fri, 21 Nov 2025 22:23:46 +0000 (23:23 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 17 Dec 2025 23:23:22 +0000 (23:23 +0000)
Follow-up for 171ceb4a00294c700c0ba6906a3a3abad846699e

In setup_output() we assume stdout has been set up properly
before stderr, hence the stdout we're inheriting from must
be writable (or more precisely, would have been adjusted to be).
Hence no need to duplicate it.

src/core/exec-invoke.c

index 7cc377a253539a7a5bca11bfb5b8b655ea4b820b..24e553e1225b5ff73cbb96311b170da7c03f9690 100644 (file)
@@ -546,17 +546,8 @@ static int setup_output(
                         return fileno;
 
                 /* Duplicate from stdout if possible */
-                if (can_inherit_stderr_from_stdout(context)) {
-                        r = fd_is_writable(STDOUT_FILENO);
-                        if (r <= 0) {
-                                if (r < 0)
-                                        log_warning_errno(r, "Failed to check if inherited stdout is writable for stderr, falling back to /dev/null.");
-                                else
-                                        log_warning("Inherited stdout is not writable for stderr, falling back to /dev/null.");
-                                return open_null_as(O_WRONLY, fileno);
-                        }
+                if (can_inherit_stderr_from_stdout(context))
                         return RET_NERRNO(dup2(STDOUT_FILENO, fileno));
-                }
 
                 o = context->std_error;