--- a/libudev/libudev-ctrl.c 2011-05-19 16:57:34.000000000 -0400 +++ b/libudev/libudev-ctrl.c 2011-07-04 00:06:09.000000000 -0400 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -179,6 +180,7 @@ struct ucred ucred; socklen_t slen; const int on = 1; + int flgs; conn = calloc(1, sizeof(struct udev_ctrl_connection)); if (conn == NULL) @@ -186,13 +188,19 @@ conn->refcount = 1; conn->uctrl = uctrl; - conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); +// conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); + conn->sock = accept(uctrl->sock, NULL, NULL); if (conn->sock < 0) { if (errno != EINTR) err(uctrl->udev, "unable to receive ctrl connection: %m\n"); goto err; } +// Since we don't have accept4 + flgs = fcntl(conn->sock, F_GETFL, NULL); + if(flgs >= 0) fcntl(conn->sock, F_SETFL, flgs | O_NONBLOCK); + fcntl(conn->sock, F_SETFD, FD_CLOEXEC); + /* check peer credential of connection */ slen = sizeof(ucred); if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) {