diff options
| author | Ayush Singh <ayush@beagleboard.org> | 2025-01-28 19:10:28 +0530 |
|---|---|---|
| committer | Ayush Singh <ayush@beagleboard.org> | 2025-01-28 19:10:28 +0530 |
| commit | 9c4fd25f278d1a04e4d3cd5138bf8ffd9ce52e6a (patch) | |
| tree | 17aa1676a6429e125a880a5fb77f14d27ceafde5 | |
| parent | aa6f5ab18e67cb815f73e0d53d217bc54b0da924 (diff) | |
| download | rust-9c4fd25f278d1a04e4d3cd5138bf8ffd9ce52e6a.tar.gz rust-9c4fd25f278d1a04e4d3cd5138bf8ffd9ce52e6a.zip | |
uefi: process: Fix args
- While working on process env support, I found that args were currently broken. Not sure how I missed it in the PR, but well here is the fix. - Additionally, no point in adding space at the end of args. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
| -rw-r--r-- | library/std/src/sys/pal/uefi/process.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/library/std/src/sys/pal/uefi/process.rs b/library/std/src/sys/pal/uefi/process.rs index 1a0754134df..3077a72eac6 100644 --- a/library/std/src/sys/pal/uefi/process.rs +++ b/library/std/src/sys/pal/uefi/process.rs @@ -460,7 +460,7 @@ mod uefi_command_internal { helpers::open_protocol(self.handle, loaded_image::PROTOCOL_GUID).unwrap(); let len = args.len(); - let args_size: u32 = crate::mem::size_of_val(&args).try_into().unwrap(); + let args_size: u32 = (len * crate::mem::size_of::<u16>()).try_into().unwrap(); let ptr = Box::into_raw(args).as_mut_ptr(); unsafe { @@ -706,9 +706,10 @@ mod uefi_command_internal { res.push(QUOTE); res.extend(prog.encode_wide()); res.push(QUOTE); - res.push(SPACE); for arg in args { + res.push(SPACE); + // Wrap the argument in quotes to be treat as single arg res.push(QUOTE); for c in arg.encode_wide() { @@ -719,8 +720,6 @@ mod uefi_command_internal { res.push(c); } res.push(QUOTE); - - res.push(SPACE); } res.into_boxed_slice() |
