]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/exec-invoke: reopen OpenFile= fds with O_NOCTTY
authorMike Yuan <me@yhndnzj.com>
Mon, 24 Jun 2024 16:26:15 +0000 (18:26 +0200)
committerMike Yuan <me@yhndnzj.com>
Mon, 24 Jun 2024 16:31:36 +0000 (18:31 +0200)
src/core/exec-invoke.c

index 45f1539f7580eb43cffb888992854f98e73d546f..254f014141e6d97faba239d744d52db72a0adf07 100644 (file)
@@ -3776,7 +3776,7 @@ static int get_open_file_fd(const ExecContext *c, const ExecParameters *p, const
                 else if (FLAGS_SET(of->flags, OPENFILE_TRUNCATE))
                         flags |= O_TRUNC;
 
-                fd = fd_reopen(ofd, flags | O_CLOEXEC);
+                fd = fd_reopen(ofd, flags|O_NOCTTY|O_CLOEXEC);
                 if (fd < 0)
                         return log_exec_error_errno(c, p, fd, "Failed to reopen file '%s': %m", of->path);