[Lldb-commits] [lldb] [lldb/Host] Enable inheriting "non-inheritable" FDs (PR #126935)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri May 2 06:27:13 PDT 2025


================
@@ -122,8 +123,14 @@ struct ForkLaunchInfo {
         ExitWithError(error_fd, "close");
       break;
     case FileAction::eFileActionDuplicate:
-      if (dup2(action.fd, action.arg) == -1)
-        ExitWithError(error_fd, "dup2");
+      if (action.fd != action.arg) {
----------------
labath wrote:

This says "I want to pass `action.fd` from *my* process as `action.arg` to the *new* process". They're the same if the caller specifies them as such, except that we now have special handling to ensure that the O_CLOEXEC flag is cleared in the new process (and only in that process).

https://github.com/llvm/llvm-project/pull/126935


More information about the lldb-commits mailing list