[PATCH 2/2] server: fix conditions for fds in wl_socket_destroy

Marek Chalupa mchqwerty at gmail.com
Wed Aug 6 03:18:12 PDT 2014


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);
-- 
2.0.4



More information about the wayland-devel mailing list