about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-12-06 15:37:13 +0900
committerGitHub <noreply@github.com>2019-12-06 15:37:13 +0900
commitf77b8d355bca91587ea5370c9294f71052dca977 (patch)
treed96019c3e850245945809df40ede9887d5c5d585 /src/libstd
parent1bb868c5d63a2f73f70558075781b9c49e76c860 (diff)
parentf7789ad5b23f0bb526f0cebdfc606374882d6feb (diff)
downloadrust-f77b8d355bca91587ea5370c9294f71052dca977.tar.gz
rust-f77b8d355bca91587ea5370c9294f71052dca977.zip
Rollup merge of #67065 - alexcrichton:update-wasi, r=sfackler
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.
Diffstat (limited to 'src/libstd')
-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 3db36f5e132..02aa68d6f3a 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>> {
         let mut argv = Vec::with_capacity(argc);
         let mut buf = Vec::with_capacity(buf_size);
         wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?;
+        argv.set_len(argc);
         let mut ret = Vec::with_capacity(argc);
         for ptr in argv {
             let s = CStr::from_ptr(ptr.cast());