diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-27 12:08:27 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-27 17:49:31 -0700 |
| commit | 034eb4e724bf138bd2d90268cd0e759f99f0d396 (patch) | |
| tree | 5941c72b81bc4a09adcf0173d5d6a9c1b9895b5b /src/liblibc | |
| parent | 746d086f9322d24fa7b389dd911e204ca35012ae (diff) | |
| download | rust-034eb4e724bf138bd2d90268cd0e759f99f0d396.tar.gz rust-034eb4e724bf138bd2d90268cd0e759f99f0d396.zip | |
native: Ignore stdio fds with /dev/null
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
Diffstat (limited to 'src/liblibc')
| -rw-r--r-- | src/liblibc/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 1edd99c1d7d..c082ebcbd63 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -235,6 +235,7 @@ pub use funcs::bsd43::{shutdown}; #[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG}; #[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR}; #[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD}; +#[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES}; #[cfg(windows)] pub use funcs::c95::string::{wcslen}; #[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir}; #[cfg(windows)] pub use funcs::bsd43::{closesocket}; @@ -1140,8 +1141,12 @@ pub mod types { pub type LPWCH = *mut WCHAR; pub type LPCH = *mut CHAR; - // Not really, but opaque to us. - pub type LPSECURITY_ATTRIBUTES = LPVOID; + pub struct SECURITY_ATTRIBUTES { + pub nLength: DWORD, + pub lpSecurityDescriptor: LPVOID, + pub bInheritHandle: BOOL, + } + pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; pub type LPVOID = *mut c_void; pub type LPCVOID = *c_void; |
