Add O_CLOEXEC to lots of open() calls.
and other related fixups.
Change-Id: Ia88fb37a07ff6777d00c49800081f5a519c0c78d
diff --git a/init/signal_handler.c b/init/signal_handler.c
index 7e8e1a7..952f970 100644
--- a/init/signal_handler.c
+++ b/init/signal_handler.c
@@ -147,13 +147,9 @@
sigaction(SIGCHLD, &act, 0);
/* create a signalling mechanism for the sigchld handler */
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, s) == 0) {
+ if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, s) == 0) {
signal_fd = s[0];
signal_recv_fd = s[1];
- fcntl(s[0], F_SETFD, FD_CLOEXEC);
- fcntl(s[0], F_SETFL, O_NONBLOCK);
- fcntl(s[1], F_SETFD, FD_CLOEXEC);
- fcntl(s[1], F_SETFL, O_NONBLOCK);
}
handle_signal();