Ignore commands if no SUDO_USER env var is found when running as root

This commit is contained in:
cyber-sushi 2024-05-08 20:18:47 +02:00
parent ce7071ce00
commit 245ee365e1

View file

@ -446,25 +446,7 @@ impl EventReader {
}
}
},
Err(_) => {
for command in command_list {
match fork() {
Ok(Fork::Child) => {
Command::new("sh")
.arg("-c")
.arg(command)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
.expect("Failed to run command.");
std::process::exit(0);
},
Ok(Fork::Parent(_)) => (),
Err(_) => std::process::exit(1),
}
}
}
_ => {}
}
},
Ok(_) => {