From 4d9e5d8e47e5bbf36027e244535cf0e7986add8e Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 9 Feb 2021 20:53:28 +0100 Subject: fix(users/Profpatsch/execline/exec_helpers): fix arg loop off-by-1 Change-Id: If20a91eaa6693ba35ce645b104c625dbd0c71726 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2500 Tested-by: BuildkiteCI Reviewed-by: Profpatsch --- users/Profpatsch/execline/exec_helpers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/Profpatsch/execline/exec_helpers.rs b/users/Profpatsch/execline/exec_helpers.rs index 9a67ffe45db5..b0b0984911a5 100644 --- a/users/Profpatsch/execline/exec_helpers.rs +++ b/users/Profpatsch/execline/exec_helpers.rs @@ -9,7 +9,7 @@ pub fn args_for_exec(current_prog_name: &str, no_of_positional_args: usize) -> ( let mut args = args.map(|arg| arg.into_vec()); let mut pos_args = vec![]; // get positional args - for i in 1..no_of_positional_args { + for i in 1..no_of_positional_args+1 { pos_args.push( args.nth(0).expect( &format!("{}: expects {} positional args, only got {}", current_prog_name, no_of_positional_args, i)) -- cgit 1.4.1