Skip to content

Commit

Permalink
use gloabl variable 'environ' to pass environments to rtpSpawn
Browse files Browse the repository at this point in the history
  • Loading branch information
bpangWR committed Jul 29, 2019
1 parent 04b88a9 commit f6906ba
Showing 1 changed file with 3 additions and 14 deletions.
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

0 comments on commit f6906ba

Please sign in to comment.