When debugging two targets concurrently, the pseude terminal master fd from the first one would
leak into the second. This fixes the problem by setting O_CLOEXEC on the master fd. Test
included.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I can't fully confirm the fix on FreeBSD at the moment due to python leaking an fd, but LGTM.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197376 but
source/Utility/PseudoTerminal.cpp | ||
---|---|---|
262 ↗ | (On Diff #19482) | in case O_CLOEXEC fails or is unsupported? |
Hi, please be careful with O_CLOEXEC in the future. I've had to fix two
patches on Windows in the past week because of it. It's not the end of the
world, but just keep in mind next time using it that it doesn't exist on
Windows so you'll need to wrap its use in an #if defined(_MSC_VER)
I'm sorry about that.
I _was_ thinking about windows, but I was like: the function is called Terminal::Fork, there is no way that can be used on windows... :)
Anyway, I should be done with this now. Thanks for fixing it up.
Heh. Sooner or later this entire file needs to be compiled out on Windows,
so your thinking was pretty close :)