[Labs-l] [tools] New version of take

Platonides platonides at gmail.com
Sun Jun 23 15:44:27 UTC 2013


On 23/06/13 09:04, Petr Bena wrote:
> Purpose of the struct is that if I forgot to close some FD it would
> get automagically closed once the object is destroyed (it's created on
> stack, so once it get removed from stack it get auto-closed)
>
> your change is correct, I should have make sure that closing it
> multiple times doesn't cause troubles, however I don't see where I am
> closing it three times?

Once by FD.Close()
Twice by FD destructor
Thrice by destructor of the FD copy created when passed by copy into 
child function.


Yes, I supposed so, but you are correctly closing the fds, and the 
object is adding more headaches than the risk that you leaked the fd 
(which would have been easy to detect).



More information about the Labs-l mailing list