grpc-proxy: Don't attempt to connect if there's no compositor running
[src/agl-compositor.git] / shared / os-compatibility.c
index 3013f1f..681a544 100644 (file)
@@ -31,7 +31,7 @@
 #include <sys/epoll.h>
 #include <string.h>
 #include <stdlib.h>
-#include <libweston-6/zalloc.h>
+#include <libweston/zalloc.h>
 
 #ifdef HAVE_MEMFD_CREATE
 #include <sys/mman.h>
@@ -403,3 +403,18 @@ os_ro_anonymous_file_put_fd(int fd)
 
        return 0;
 }
+
+int
+os_fd_clear_cloexec(int fd)
+{
+       int flags;
+
+       flags = fcntl(fd, F_GETFD);
+       if (flags == -1)
+               return -1;
+
+       if (fcntl(fd, F_SETFD, flags & ~(int)FD_CLOEXEC) == -1)
+               return -1;
+
+       return 0;
+}