about summary refs log tree commit diff
path: root/library/std/src/os/windows
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-05-15 18:41:27 +0200
committerGitHub <noreply@github.com>2022-05-15 18:41:27 +0200
commitd56c59efdcb394c863c70a79bfbbe8ddfc1ece0a (patch)
tree84a508ab94d12d8e43757e8596aae0286162211d /library/std/src/os/windows
parentede4f0ef68f06b7d0266b56dbdb5ee1258716a61 (diff)
parent4f637ee30ba1ec9ab15c8b5d12e80e8ae810a811 (diff)
downloadrust-d56c59efdcb394c863c70a79bfbbe8ddfc1ece0a.tar.gz
rust-d56c59efdcb394c863c70a79bfbbe8ddfc1ece0a.zip
Rollup merge of #97060 - bdbai:fix/uwphandle, r=ChrisDenton
Fix use of SetHandleInformation on UWP

The use of `SetHandleInformation` (introduced in #96441 to make `HANDLE` inheritable) breaks UWP builds because it is not available for UWP targets.

Proposed workaround: duplicate the `HANDLE` with `inherit = true` and immediately close the old one. Traditional Windows Desktop programs are not affected.

cc `@ChrisDenton`
Diffstat (limited to 'library/std/src/os/windows')
-rw-r--r--library/std/src/os/windows/io/handle.rs1
-rw-r--r--library/std/src/os/windows/io/socket.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs
index f27970eaaf1..0ecac6b4475 100644
--- a/library/std/src/os/windows/io/handle.rs
+++ b/library/std/src/os/windows/io/handle.rs
@@ -206,6 +206,7 @@ impl OwnedHandle {
     }
 
     /// Allow child processes to inherit the handle.
+    #[cfg(not(target_vendor = "uwp"))]
     pub(crate) fn set_inheritable(&self) -> io::Result<()> {
         cvt(unsafe {
             c::SetHandleInformation(
diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs
index baae92c19f2..e23e1cf8cee 100644
--- a/library/std/src/os/windows/io/socket.rs
+++ b/library/std/src/os/windows/io/socket.rs
@@ -10,6 +10,7 @@ use crate::mem;
 use crate::mem::forget;
 use crate::sys;
 use crate::sys::c;
+#[cfg(not(target_vendor = "uwp"))]
 use crate::sys::cvt;
 
 /// A borrowed socket.