Add O_CLOEXEC to lots of open() calls.

and other related fixups.

Change-Id: Ia88fb37a07ff6777d00c49800081f5a519c0c78d
diff --git a/init/keychords.c b/init/keychords.c
index 4a64042..5a9e45f 100644
--- a/init/keychords.c
+++ b/init/keychords.c
@@ -72,12 +72,11 @@
     if (!keychords)
         return;
 
-    fd = open("/dev/keychord", O_RDWR);
+    fd = open("/dev/keychord", O_RDWR | O_CLOEXEC);
     if (fd < 0) {
         ERROR("could not open /dev/keychord\n");
         return;
     }
-    fcntl(fd, F_SETFD, FD_CLOEXEC);
 
     ret = write(fd, keychords, keychords_length);
     if (ret != keychords_length) {