Loading init/util.cpp +19 −14 Original line number Diff line number Diff line Loading @@ -379,23 +379,28 @@ int wait_for_file(const char *filename, int timeout) void open_devnull_stdio(void) { int fd; // Try to avoid the mknod() call if we can. Since SELinux makes // a /dev/null replacement available for free, let's use it. int fd = open("/sys/fs/selinux/null", O_RDWR); if (fd == -1) { // OOPS, /sys/fs/selinux/null isn't available, likely because // /sys/fs/selinux isn't mounted. Fall back to mknod. static const char *name = "/dev/__null__"; if (mknod(name, S_IFCHR | 0600, (1 << 8) | 3) == 0) { fd = open(name, O_RDWR); unlink(name); if (fd >= 0) { } if (fd == -1) { exit(1); } } dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); if (fd > 2) { close(fd); } return; } } exit(1); } void import_kernel_cmdline(int in_qemu, Loading Loading
init/util.cpp +19 −14 Original line number Diff line number Diff line Loading @@ -379,23 +379,28 @@ int wait_for_file(const char *filename, int timeout) void open_devnull_stdio(void) { int fd; // Try to avoid the mknod() call if we can. Since SELinux makes // a /dev/null replacement available for free, let's use it. int fd = open("/sys/fs/selinux/null", O_RDWR); if (fd == -1) { // OOPS, /sys/fs/selinux/null isn't available, likely because // /sys/fs/selinux isn't mounted. Fall back to mknod. static const char *name = "/dev/__null__"; if (mknod(name, S_IFCHR | 0600, (1 << 8) | 3) == 0) { fd = open(name, O_RDWR); unlink(name); if (fd >= 0) { } if (fd == -1) { exit(1); } } dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); if (fd > 2) { close(fd); } return; } } exit(1); } void import_kernel_cmdline(int in_qemu, Loading