diff --git a/src/udev-ctrl.c b/src/udev-ctrl.c
index 5556f1a..a1c8d74 100644
--- a/src/udev-ctrl.c
+++ b/src/udev-ctrl.c
@@ -15,6 +15,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
@@ -176,6 +177,14 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl)
         return uctrl->sock;
 }
 
+int replace_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+	int sock = accept(s, addr, addrlen);
+	if(sock < 0) return sock;
+	int res = fcntl(sock, F_SETFL, flags);
+	return (res > -1) ? sock : res;
+}
+
 struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
 {
         struct udev_ctrl_connection *conn;
@@ -189,7 +198,8 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
         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 = replace_accept4(uctrl->sock, NULL, NULL, O_NONBLOCK);
         if (conn->sock < 0) {
                 if (errno != EINTR)
                         err(uctrl->udev, "unable to receive ctrl connection: %m\n");
