Skip to content

Commit

Permalink
print error message if gid parsing failed
Browse files Browse the repository at this point in the history
  • Loading branch information
5ec1cff committed Jan 1, 2024
1 parent 675cadd commit fce0078
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion userspace/ksud/src/ksu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,19 @@ pub fn root_shell() -> Result<()> {
if let core::result::Result::Ok(id) = g.parse::<u32>() {
groups.push(id);
} else {
println!("Invalid GID: {}", g);
print_usage(&program, opts);
return Ok(());
}
}
let mut gid: Option<u32> = None;
// if -g provided, use it.
if matches.opt_present("g") {
if let core::result::Result::Ok(id) = matches.opt_str("g").unwrap().parse::<u32>() {
let g = matches.opt_str("g").unwrap();
if let core::result::Result::Ok(id) = g.parse::<u32>() {
gid = Some(id);
} else {
println!("Invalid GID: {}", g);
print_usage(&program, opts);
return Ok(());
}
Expand Down

0 comments on commit fce0078

Please sign in to comment.