On Wed,  6 Aug 2014 12:18:12 +0200
Marek Chalupa <[email protected]> wrote:

> The only value that is false with the former condition is 0.
> On error we set fd to -1.
> ---
>  src/wayland-server.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index ce7bbff..c8aecb8 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -848,11 +848,11 @@ wl_socket_destroy(struct wl_socket *s)
>               wl_event_source_remove(s->source);
>       if (s->addr.sun_path[0])
>               unlink(s->addr.sun_path);
> -     if (s->fd)
> +     if (s->fd > 0)
>               close(s->fd);
>       if (s->lock_addr[0])
>               unlink(s->lock_addr);
> -     if (s->fd_lock)
> +     if (s->fd_lock > 0)
>               close(s->fd_lock);
>  
>       free(s);

Hi,

also fd 0 is valid. Unfortunately, allowing to close fd 0 here leads to
'make check' failure, as the test accidentally closes stdout_fileno,
because the fds are not initialized to -1.

I will send a replacement patch.


Thanks,
pq
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to