Skip to content

Commit

Permalink
Fix whitespaces in init/init.c, no functional changes.
Browse files Browse the repository at this point in the history
Preparation for a couple of fixes/improvements, these are only re-indents and
some tabs vs spaces so that the next commit intention is clear.

Signed-off-by: Christiano Haesbaert <[email protected]>
  • Loading branch information
haesbaert committed Jan 22, 2022
1 parent ab45d68 commit 47eb1ea
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,38 +69,38 @@ int main(int argc, char **argv)
if (passp) {
printf("Unlocking LUKS root filesystem\n");

if (mount("proc", "/proc", "proc",
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/proc)");
exit(-1);
}
if (mount("proc", "/proc", "proc",
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/proc)");
exit(-1);
}

pipe(pipefd);
pipe(pipefd);

pid = fork();
if (pid == 0) {
pid = fork();
if (pid == 0) {
close(pipefd[1]);
dup2(pipefd[0], 0);
close(pipefd[0]);
dup2(pipefd[0], 0);
close(pipefd[0]);

if (execl("/sbin/cryptsetup", "cryptsetup", "open", "/dev/vda", "luksroot", "-", NULL) < 0) {
if (execl("/sbin/cryptsetup", "cryptsetup", "open", "/dev/vda", "luksroot", "-", NULL) < 0) {
perror("execl");
exit(-1);
}
} else {
write(pipefd[1], passp, strnlen(passp, 128));
close(pipefd[1]);
waitpid(pid, &wstatus, 0);
}
} else {
write(pipefd[1], passp, strnlen(passp, 128));
close(pipefd[1]);
waitpid(pid, &wstatus, 0);
}

printf("Mounting LUKS root filesystem\n");

if (mount("/dev/mapper/luksroot", "/luksroot", "ext4", 0, NULL) < 0) {
perror("mount(/luksroot)");
exit(-1);
}
if (mount("/dev/mapper/luksroot", "/luksroot", "ext4", 0, NULL) < 0) {
perror("mount(/luksroot)");
exit(-1);
}

chdir("/luksroot");
chdir("/luksroot");

if (mount(".", "/", NULL, MS_MOVE, NULL)) {
perror("remount root");
Expand All @@ -110,19 +110,19 @@ int main(int argc, char **argv)
}

if (mount("proc", "/proc", "proc",
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/proc)");
exit(-1);
}

if (mount("sysfs", "/sys", "sysfs",
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/sys)");
exit(-1);
}

if (mount("cgroup2", "/sys/fs/cgroup", "cgroup2",
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/sys/fs/cgroup)");
exit(-1);
}
Expand All @@ -133,7 +133,7 @@ int main(int argc, char **argv)
}

if (mount("devpts", "/dev/pts", "devpts",
MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/dev/pts)");
exit(-1);
}
Expand All @@ -144,7 +144,7 @@ int main(int argc, char **argv)
}

if (mount("tmpfs", "/dev/shm", "tmpfs",
MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {
perror("mount(/dev/shm)");
exit(-1);
}
Expand Down

0 comments on commit 47eb1ea

Please sign in to comment.