Skip to contentSkip to conversation

Fix initramfs permissions on directories and special files

PATCH New Anton Blanchard 1 participant 1 message Sep 10, 2003 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix initramfs permissions on directories and special files

Set correct permissions on initramfs directories and special files. We dont want to obey the umask here, so do the same thing we do on normal files - call sys_chmod.

 work-anton/init/initramfs.c |    2 ++
 1 files changed, 2 insertions(+)
init/initramfs.c renamed from init/initramfs.c~initramfs-fix +2 -0
diff -puN init/initramfs.c~initramfs-fix init/initramfs.c
@@ -260,11 +260,13 @@ static int __init do_name(void)
 	} else if (S_ISDIR(mode)) {
 		sys_mkdir(collected, mode);
 		sys_chown(collected, uid, gid);
+		sys_chmod(collected, mode);
 	} else if (S_ISBLK(mode) || S_ISCHR(mode) ||
 		   S_ISFIFO(mode) || S_ISSOCK(mode)) {
 		if (maybe_link() == 0) {
 			sys_mknod(collected, mode, rdev);
 			sys_chown(collected, uid, gid);
+			sys_chmod(collected, mode);
 		}
 	} else
 		panic("populate_root: bogus mode: %o\n", mode);

_