summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2019-12-05 11:01:26 -0800
committerAlex Crichton <alex@alexcrichton.com>2019-12-05 11:01:26 -0800
commitf7789ad5b23f0bb526f0cebdfc606374882d6feb (patch)
treeb3a09e71e259e3cfed385e96a912c1e8f9fc38e5
parentAuto merge of #66815 - mark-i-m:simplify-borrow_check-errors, r=Dylan-DPC (diff)
downloadrust-f7789ad5b23f0bb526f0cebdfc606374882d6feb.tar.gz
rust-f7789ad5b23f0bb526f0cebdfc606374882d6feb.tar.bz2
rust-f7789ad5b23f0bb526f0cebdfc606374882d6feb.tar.xz
Fix fetching arguments on the wasm32-wasi target
Fixes an error introduced in #66750 where wasi executables always think they have zero arguments because one of the vectors returned here accidentally thought it was length 0.
-rw-r--r--src/libstd/sys/wasi/args.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/sys/wasi/args.rs b/src/libstd/sys/wasi/args.rs
index 3db36f5..02aa68d 100644
--- a/src/libstd/sys/wasi/args.rs
+++ b/src/libstd/sys/wasi/args.rs
@@ -26,6 +26,7 @@ fn maybe_args() -> Option<Vec<OsString>> {
26 let mut argv = Vec::with_capacity(argc); 26 let mut argv = Vec::with_capacity(argc);
27 let mut buf = Vec::with_capacity(buf_size); 27 let mut buf = Vec::with_capacity(buf_size);
28 wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?; 28 wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?;
29 argv.set_len(argc);
29 let mut ret = Vec::with_capacity(argc); 30 let mut ret = Vec::with_capacity(argc);
30 for ptr in argv { 31 for ptr in argv {
31 let s = CStr::from_ptr(ptr.cast()); 32 let s = CStr::from_ptr(ptr.cast());