Fall back to accept() on systems where accept4() is not implemented.

This commit is contained in:
Samuel Rødal 2011-05-30 17:23:40 +02:00 committed by Kristian Høgsberg
parent b06e891e4c
commit 02e1ffdefe

View File

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