From 02e1ffdefef7b3e3dd82198a0f2f7503e7883e9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20R=C3=B8dal?= Date: Mon, 30 May 2011 17:23:40 +0200 Subject: [PATCH] Fall back to accept() on systems where accept4() is not implemented. --- wayland/wayland-server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c index d30df5b..886ec69 100644 --- a/wayland/wayland-server.c +++ b/wayland/wayland-server.c @@ -703,8 +703,14 @@ socket_data(int fd, uint32_t mask, void *data) length = sizeof name; client_fd = accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC); + if (client_fd < 0 && errno == ENOSYS) { + client_fd = accept(fd, (struct sockaddr *) &name, &length); + if (client_fd >= 0 && fcntl(client_fd, F_SETFD, FD_CLOEXEC) == -1) + fprintf(stderr, "failed to set FD_CLOEXEC flag on client fd, errno: %d\n", errno); + } + if (client_fd < 0) - fprintf(stderr, "failed to accept\n"); + fprintf(stderr, "failed to accept, errno: %d\n", errno); wl_client_create(display, client_fd); -- 2.7.4