On Mon, 7 Dec 2015 22:49:17 -0800 Bryce Harrington <br...@osg.samsung.com> wrote:
> Move the the wl_os_socket_cloexec() to the callers. > > Signed-off-by: Bryce Harrington <br...@osg.samsung.com> > --- > src/wayland-server.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/src/wayland-server.c b/src/wayland-server.c > index 0f04f66..7c25858 100644 > --- a/src/wayland-server.c > +++ b/src/wayland-server.c > @@ -1129,15 +1129,10 @@ wl_socket_init_for_display_name(struct wl_socket *s, > const char *name) > } > > static int > -_wl_display_add_socket(struct wl_display *display, struct wl_socket *s) > +_wl_display_bind_socket_source(struct wl_display *display, struct wl_socket > *s) > { > socklen_t size; > > - s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); > - if (s->fd < 0) { > - return -1; > - } > - > size = offsetof (struct sockaddr_un, sun_path) + > strlen(s->addr.sun_path); > if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) { > wl_log("bind() failed with error: %m\n"); > @@ -1153,6 +1148,7 @@ _wl_display_add_socket(struct wl_display *display, > struct wl_socket *s) > WL_EVENT_READABLE, > socket_data, display); > if (s->source == NULL) { > + wl_log("failed to establish event source\n"); > return -1; > } > > @@ -1185,7 +1181,13 @@ wl_display_add_socket_auto(struct wl_display *display) > if (wl_socket_lock(s) < 0) > continue; > > - if (_wl_display_add_socket(display, s) < 0) { > + s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); > + if (s->fd < 0) { > + wl_socket_destroy(s); > + return NULL; > + } > + > + if (_wl_display_bind_socket_source(display, s) < 0) { > wl_socket_destroy(s); > return NULL; > } > @@ -1247,7 +1249,13 @@ wl_display_add_socket(struct wl_display *display, > const char *name) > return -1; > } > > - if (_wl_display_add_socket(display, s) < 0) { > + s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); > + if (s->fd <0) { > + wl_socket_destroy(s); > + return -1; > + } > + > + if (_wl_display_bind_socket_source(display, s) < 0) { > wl_socket_destroy(s); > return -1; > } Hi, this looks good to me (didn't test), so assuming the patch adding wl_display_add_socket_fd() is good: Reviewed-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Thanks, pq
pgpvZR7OORdxu.pgp
Description: OpenPGP digital signature
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel