diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-12-06 15:36:56 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-06 15:36:56 +0900 |
| commit | 617b07e7302065d8aaed18ab0baf88cfb9e8e054 (patch) | |
| tree | bcd96e96f0627d7a5feb976836ce9ff212838c72 /src/libstd/sys/vxworks/process | |
| parent | 234c9f21d9930e4ae804d00b191d0780959cfcbe (diff) | |
| parent | de362b41468f71ab7b1843007f97d4c1ca93638c (diff) | |
| download | rust-617b07e7302065d8aaed18ab0baf88cfb9e8e054.tar.gz rust-617b07e7302065d8aaed18ab0baf88cfb9e8e054.zip | |
Rollup merge of #66649 - Wind-River:master_xyz, r=alexcrichton
VxWorks: fix issues in accessing environment variables
Diffstat (limited to 'src/libstd/sys/vxworks/process')
| -rw-r--r-- | src/libstd/sys/vxworks/process/process_vxworks.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs index 7446471ae31..79bfd770f8e 100644 --- a/src/libstd/sys/vxworks/process/process_vxworks.rs +++ b/src/libstd/sys/vxworks/process/process_vxworks.rs @@ -15,6 +15,7 @@ impl Command { -> io::Result<(Process, StdioPipes)> { use crate::sys::{cvt_r}; const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX"; + let envp = self.capture_env(); if self.saw_nul() { return Err(io::Error::new(ErrorKind::InvalidInput, @@ -52,12 +53,19 @@ impl Command { t!(cvt(libc::chdir(cwd.as_ptr()))); } + let c_envp = envp.as_ref().map(|c| c.as_ptr()) + .unwrap_or_else(|| *sys::os::environ() as *const _); + let stack_size = thread::min_stack(); + + // ensure that access to the environment is synchronized + let _lock = sys::os::env_lock(); + let ret = libc::rtpSpawn( self.get_argv()[0], // executing program self.get_argv().as_ptr() as *mut *const c_char, // argv - *sys::os::environ() as *mut *const c_char, + c_envp as *mut *const c_char, 100 as c_int, // initial priority - thread::min_stack(), // initial stack size. + stack_size, // initial stack size. 0, // options 0 // task options ); |
