Merge "init: Change umask of forked processes to 077"
diff --git a/init/init.c b/init/init.c
index 5458e34..483544a 100755
--- a/init/init.c
+++ b/init/init.c
@@ -240,6 +240,7 @@
char tmp[32];
int fd, sz;
+ umask(077);
if (properties_inited()) {
get_property_workspace(&fd, &sz);
sprintf(tmp, "%d,%d", dup(fd), sz);
diff --git a/init/ueventd.c b/init/ueventd.c
index ecf3b9b..a89e067 100644
--- a/init/ueventd.c
+++ b/init/ueventd.c
@@ -53,11 +53,18 @@
int nr;
char tmp[32];
- /* Prevent fire-and-forget children from becoming zombies.
- * If we should need to wait() for some children in the future
- * (as opposed to none right now), double-forking here instead
- * of ignoring SIGCHLD may be the better solution.
- */
+ /*
+ * init sets the umask to 077 for forked processes. We need to
+ * create files with exact permissions, without modification by
+ * the umask.
+ */
+ umask(000);
+
+ /* Prevent fire-and-forget children from becoming zombies.
+ * If we should need to wait() for some children in the future
+ * (as opposed to none right now), double-forking here instead
+ * of ignoring SIGCHLD may be the better solution.
+ */
signal(SIGCHLD, SIG_IGN);
open_devnull_stdio();