Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use global variable 'environ' to pass environments to rtpSpawn #63117

Merged
merged 1 commit into from
Jul 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/libstd/sys/vxworks/process/process_vxworks.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::io::{self, Error, ErrorKind};
use libc::{self, c_int};
use libc::{self, c_int, c_char};
use libc::{RTP_ID};

use crate::sys;
use crate::sys::cvt;
use crate::sys::process::rtp;
use crate::sys::process::process_common::*;
Expand All @@ -16,8 +16,6 @@ impl Command {
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,
"nul byte found in provided data"));
Expand Down Expand Up @@ -54,19 +52,10 @@ impl Command {
t!(cvt(libc::chdir(cwd.as_ptr())));
}

// let envp = envp.map(|c| c.as_ptr())
// .unwrap_or(*sys::os::environ() as *const _);
// FIXME: https://github.com/rust-lang/rust/issues/61993
let envp_empty = CStringArray::with_capacity(0);
let envp = match envp {
Some(x) => x,
None => envp_empty,
};
let envp = envp.as_ptr();
let ret = rtp::rtpSpawn(
self.get_argv()[0], // executing program
self.get_argv().as_ptr() as *const _, // argv
envp as *const _, // environment variable pointers
*sys::os::environ() as *const *const c_char,
100 as c_int, // initial priority
0x16000, // initial stack size. 0 defaults
// to 0x4000 in 32 bit and 0x8000 in 64 bit
Expand Down