This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 4/6] Use mkostemp, not mkstemp
On 2018-09-29 8:49 a.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
> Simon> On 2018-09-26 7:11 a.m., Tom Tromey wrote:
>>> I noticed that gdb could leak file descriptors coming from mkstemp.
>>> This patch fixes the problem by importing the gnulib mkostemp instead,
>>> and then changing gdb to pass O_CLOEXEC.
>
> Simon> While this looks like the correct thing to do, I am curious to know if
> Simon> you encountered an actual issue or this is theoretical. I don't see
> Simon> how a fork/exec could happen while one of these temp files are open.
>
> It can happen if there is a Python or Guile thread that fork+execs.
> It seems like it would be hard to observe, but on the other hand, fixing
> it seems pretty easy.
Ah I see, I was only thinking about the exec when you use "run".
Thanks!
Simon