Re: port leak in select

2016-12-02 Thread Samuel Thibault
Richard Braun, on Fri 02 Dec 2016 10:56:40 +0100, wrote: > On Fri, Dec 02, 2016 at 10:43:04AM +0100, Samuel Thibault wrote: > > Or simply > > > > (d[i].reply_port != MACH_PORT_NULL)) > > Aren't there cases where an entry could remain uninitialized ? Here, no, we have the same structure: if

Re: port leak in select

2016-12-02 Thread Richard Braun
On Fri, Dec 02, 2016 at 10:43:04AM +0100, Samuel Thibault wrote: > Or simply > > (d[i].reply_port != MACH_PORT_NULL)) Aren't there cases where an entry could remain uninitialized ? -- Richard Braun

Re: port leak in select

2016-12-02 Thread Samuel Thibault
Richard Braun, on Fri 02 Dec 2016 10:28:48 +0100, wrote: > > as well as in the error case of __io_select_request, and then just check > > against MACH_PORT_NULL before destroy. > > So the condition would look like > > if (d[i].type && (d[i].reply_port != MACH_PORT_NULL)) Or simply (d[i].reply

Re: port leak in select

2016-12-02 Thread Richard Braun
On Fri, Dec 02, 2016 at 08:41:21AM +0100, Samuel Thibault wrote: > About the port leak in select discussed on IRC, I checked history a bit, > this (000ef460744786571f51604e6de631b7168e239a): > > - if (d[i].type) > + if (d[i].type & ~SELECT_ERROR) > __mach_port_destroy (__mach_tas

port leak in select

2016-12-02 Thread Samuel Thibault
Hello, About the port leak in select discussed on IRC, I checked history a bit, this (000ef460744786571f51604e6de631b7168e239a): - if (d[i].type) + if (d[i].type & ~SELECT_ERROR) __mach_port_destroy (__mach_task_self (), d[i].reply_port); was added when handling EBADF , for whi