This function will be used between fork() and exec() to remove the
close-on-exec flag. The first user will be compositor/xwayland.c.
Bug-AGL: SPEC-4510
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib2245394654651583f9d59785540962ae4cb8a28
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;
+}
int
os_ro_anonymous_file_put_fd(int fd);
+int
+os_fd_clear_cloexec(int fd);
+
#endif /* OS_COMPATIBILITY_H */