<div dir="ltr"><div>Yeah, this looks good to me.  It does change the order of a couple of system calls, but it looks ok to me.<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 7, 2014 at 9:25 AM, Jasper St. Pierre <span dir="ltr"><<a href="mailto:jstpierre@mecheye.net" target="_blank">jstpierre@mecheye.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 src/wayland-server.c | 15 +++++++--------<br>
<div class=""> 1 file changed, 7 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/wayland-server.c b/src/wayland-server.c<br>
</div>index e850d48..d0fd280 100644<br>
<div class="">--- a/src/wayland-server.c<br>
+++ b/src/wayland-server.c<br>
@@ -1061,12 +1061,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)<br>
        if (s == NULL)<br>
                return -1;<br>
<br>
-       s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);<br>
-       if (s->fd < 0) {<br>
-               free(s);<br>
-               return -1;<br>
-       }<br>
-<br>
        if (name == NULL)<br>
                name = getenv("WAYLAND_DISPLAY");<br>
        if (name == NULL)<br>
@@ -1081,7 +1075,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)<br>
        if (name_size > (int)sizeof s->addr.sun_path) {<br>
                wl_log("error: socket path \"%s/%s\" plus null terminator"<br>
                       " exceeds 108 bytes\n", runtime_dir, name);<br>
-               close(s->fd);<br>
                free(s);<br>
                /* to prevent programs reporting<br>
                 * "failed to add socket: Success" */<br>
</div>@@ -1091,7 +1084,13 @@ wl_display_add_socket(struct wl_display *display, const char *name)<br>
<div class=""><br>
        s->fd_lock = get_socket_lock(s);<br>
        if (s->fd_lock < 0) {<br>
-               close(s->fd);<br>
+               free(s);<br>
+               return -1;<br>
+       }<br>
+<br>
+       s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);<br>
+       if (s->fd < 0) {<br>
</div>+               close(s->fd_lock);<br>
<div class="HOEnZb"><div class="h5">                free(s);<br>
                return -1;<br>
        }<br>
--<br>
1.9.0<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>