[OpenWrt-Devel] [PATCH procd] fix /dev/shm permissions, this time for real

Daniel Gimpelevich daniel at gimpelevich.san-francisco.ca.us
Wed Jun 17 09:18:36 EDT 2015


Previous patch did not account for umask, now adding that.

Signed-off-by: Daniel Gimpelevich <daniel at gimpelevich.san-francisco.ca.us>
--- a/initd/early.c
+++ b/initd/early.c
@@ -60,6 +60,8 @@
 static void
 early_mounts(void)
 {
+	unsigned int oldumask = umask(0);
+
 	mount("proc", "/proc", "proc", MS_NOATIME, 0);
 	mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
 	mount("none", "/sys/fs/cgroup", "cgroup", 0, 0);
@@ -77,6 +79,7 @@
 	mkdir("/tmp/run", 0777);
 	mkdir("/tmp/lock", 0777);
 	mkdir("/tmp/state", 0777);
+	umask(oldumask);
 }
 
 static void
--- a/plug/coldplug.c
+++ b/plug/coldplug.c
@@ -40,12 +40,14 @@
 void procd_coldplug(void)
 {
 	char *argv[] = { "udevtrigger", NULL };
+	unsigned int oldumask = umask(0);
 
 	umount2("/dev/pts", MNT_DETACH);
 	umount2("/dev/", MNT_DETACH);
 	mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");
 	mkdir("/dev/shm", 01777);
 	mkdir("/dev/pts", 0755);
+	umask(oldumask);
 	mount("devpts", "/dev/pts", "devpts", 0, 0);
 	udevtrigger.cb = udevtrigger_complete;
 	udevtrigger.pid = fork();
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list