server: fix conditions for fds in wl_socket_destroy
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 7 Aug 2014 13:46:52 +0000 (16:46 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 7 Aug 2014 13:59:14 +0000 (16:59 +0300)
commitced769ac92c96c4ef8dab585b02c9d211482b5ee
tree376781c2263eed8f30d4d46ff0020123751c1633
parent3a84e45a3043a0025ecfd5f1a496fafac95fd01f
server: fix conditions for fds in wl_socket_destroy

0 is also a valid fd, and needs to be closed.

On error we set fd to -1. We need to also initialize fds to -1, so we do
not accidentally close stdout on error.

While fixing this, also remove one use-before-NULL-check.

Based on the patch by Marek.

Cc: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
src/wayland-server.c