about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2022-10-24 02:34:48 +0100
committerChris Denton <christophersdenton@gmail.com>2022-10-24 02:34:48 +0100
commitc43210f67be938e14f8193cc87309a5469ef3705 (patch)
tree510afb1182b8e96ffc7617ac40adc7ccb6c069c5 /library/std/src
parent7aa361390867181d225a7775340f50e8162e16a2 (diff)
downloadrust-c43210f67be938e14f8193cc87309a5469ef3705.tar.gz
rust-c43210f67be938e14f8193cc87309a5469ef3705.zip
Pass on null handle values to child process
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/windows/process.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs
index 9cbb4ef19e9..32be07aee8f 100644
--- a/library/std/src/sys/windows/process.rs
+++ b/library/std/src/sys/windows/process.rs
@@ -513,9 +513,6 @@ fn program_exists(path: &Path) -> Option<Vec<u16>> {
 impl Stdio {
     fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
         match *self {
-            // If no stdio handle is available, then inherit means that it
-            // should still be unavailable so propagate the
-            // INVALID_HANDLE_VALUE.
             Stdio::Inherit => match stdio::get_handle(stdio_id) {
                 Ok(io) => unsafe {
                     let io = Handle::from_raw_handle(io);
@@ -523,7 +520,8 @@ impl Stdio {
                     io.into_raw_handle();
                     ret
                 },
-                Err(..) => unsafe { Ok(Handle::from_raw_handle(c::INVALID_HANDLE_VALUE)) },
+                // If no stdio handle is available, then propagate the null value.
+                Err(..) => unsafe { Ok(Handle::from_raw_handle(ptr::null_mut())) },
             },
 
             Stdio::MakePipe => {
@@ -730,9 +728,9 @@ fn zeroed_startupinfo() -> c::STARTUPINFO {
         wShowWindow: 0,
         cbReserved2: 0,
         lpReserved2: ptr::null_mut(),
-        hStdInput: c::INVALID_HANDLE_VALUE,
-        hStdOutput: c::INVALID_HANDLE_VALUE,
-        hStdError: c::INVALID_HANDLE_VALUE,
+        hStdInput: ptr::null_mut(),
+        hStdOutput: ptr::null_mut(),
+        hStdError: ptr::null_mut(),
     }
 }