aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-11-13 19:53:40 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-11-13 19:53:40 +0100
commit7bf851d9e42b795a7fdb8a8a4f8911b72ed20d24 (patch)
treea0e29ca2a1615e3ed86e55719f442f9285392a26
parent53dc7f0d3ac3b309c575bb634e35acd3b834d887 (diff)
move pid check to top of main
-rw-r--r--src/main.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index 0b0ff19..bf254c1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -224,6 +224,11 @@ fn mount_or_halt(part_id: u8, mount_point: &str, fs: &str) -> UnmountDrop<Mount>
}
fn main() -> ExitCode {
+ if process::id() != 1 {
+ log!(Color::Red, "[ ERROR ] must be run as PID 1");
+ halt!();
+ }
+
let _boot_handle = mount_or_halt(1, "/boot", "vfat");
let _data_handle = mount_or_halt(4, "/data", "ext4");
let _proc_handle = Mount::builder()
@@ -239,11 +244,6 @@ fn main() -> ExitCode {
.mount("tmpfs", "/run")
.expect("can't mount /run tmpfs");
- if process::id() != 1 {
- log!(Color::Red, "[ ERROR ] must be run as PID 1");
- halt!();
- }
-
match start() {
Ok(_) => {}
Err(e) => log!(Color::Red, "[ ERROR ] {}", e),