================
@@ -242,8 +242,10 @@ llvm::ErrorOr<std::vector<HANDLE>> 
ProcessLauncherWindows::GetInheritedHandles(
   for (size_t i = 0; i < launch_info.GetNumFileActions(); ++i) {
     const FileAction *act = launch_info.GetFileActionAtIndex(i);
     if (act->GetAction() == FileAction::eFileActionDuplicate &&
-        act->GetFD() == act->GetActionArgument())
-      inherited_handles.push_back(reinterpret_cast<HANDLE>(act->GetFD()));
+        act->GetFD() == act->GetActionArgument() &&
+        std::find(inherited_handles.begin(), inherited_handles.end(),
+                  act->GetHandle()) != inherited_handles.end())
----------------
DavidSpickett wrote:

I don't know the context well so just looking at this change, the logic is 
suspicious to me.

It seems to say, if act->GetHandle() is already in inherited_handles, then add 
it again to inherited_handles. Is that correct?

Maybe it is, and this makes sense because we are looking here at 
eFileActionDuplicate actions and we cannot duplicate something that's not 
already in the list.

https://github.com/llvm/llvm-project/pull/179274
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to