qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Don't leak file descriptors


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] Don't leak file descriptors
Date: Fri, 13 Nov 2009 16:44:00 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4

Am 13.11.2009 16:41, schrieb Nathan Froyd:
> On Fri, Nov 13, 2009 at 04:17:16PM +0100, Kevin Wolf wrote:
>> We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
>> descriptors that don't need to be passed to children to stop this
>> misbehaviour.
>>
>>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -2356,6 +2356,9 @@ static void gdb_accept(void)
>>              perror("accept");
>>              return;
>>          } else if (fd >= 0) {
>> +#ifndef _WIN32
>> +            fcntl(fd, F_SETFD, FD_CLOEXEC);
>> +#endif
>>              break;
>>          }
>>      }
> 
> Why not just use the new accept wrapper here?

gdbstub.c is also used in the Linux userspace emulator where the accept
wrapper is not available. I tried to add osdep.c to the linux-user build
- after all, it looked easy enough - but it ended up being too much
Makefile magic. This is why I decided to go for the easy way and expand it.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]