[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: PATCH: Get rid of superfluous dup() and close() calls.
From:       Alexandre Julliard <julliard () winehq ! com>
Date:       2003-01-31 21:37:10
[Download RAW message or body]

Martin Wilck <Martin.Wilck@fujitsu-siemens.com> writes:

> The dup() in wine_server_handle_to_fd() requires dozens of close()
> calls spread over the wine code. I think this is confusing and error-prone
> (close() calls are easily forgotten, leading to rapid fd leak - actually, 
> when looking through the code, I found a number of functions where I 
> had expected a close(), but it was lacking).
> Moreover, I can't see why that dup() is necessary (any more). 

I think it's cleaner to return a dup of the fd instead of relying on
the fact that the fd is cached internally. This may not always be the
case, and it's better to risk an fd leak than to risk invalidating the
cached value in case someone closes the fd when they shouldn't.

-- 
Alexandre Julliard
julliard@winehq.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic