Ignore commands if no SUDO_USER env var is found when running as root
This commit is contained in:
parent
ce7071ce00
commit
245ee365e1
1 changed files with 1 additions and 19 deletions
|
@ -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(_) => {
|
Ok(_) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue