Skip to content

Commit f7246a3

Browse files
committed
Fix socket.rs
1 parent 04a8839 commit f7246a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vm/src/stdlib/socket.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::io::Read;
44
use std::io::Write;
55
use std::net::{Ipv4Addr, SocketAddr, TcpListener, TcpStream, ToSocketAddrs, UdpSocket};
66

7-
#[cfg(unix)]
7+
#[cfg(all(unix, not(target_os = "redox")))]
88
use nix::unistd::sethostname;
99

1010
use gethostname::gethostname;
@@ -388,7 +388,7 @@ fn socket_gethostname(vm: &VirtualMachine) -> PyResult {
388388
.map_err(|err| vm.new_os_error(err.into_string().unwrap()))
389389
}
390390

391-
#[cfg(unix)]
391+
#[cfg(all(unix, not(target_os = "redox")))]
392392
fn socket_sethostname(hostname: PyStringRef, vm: &VirtualMachine) -> PyResult<()> {
393393
sethostname(hostname.value.as_str()).map_err(|err| convert_nix_error(vm, err))
394394
}
@@ -449,6 +449,7 @@ fn extend_module_platform_specific(_vm: &VirtualMachine, module: PyObjectRef) ->
449449
fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) -> PyObjectRef {
450450
let ctx = &vm.ctx;
451451

452+
#[cfg(not(target_os = "redox"))]
452453
extend_module!(vm, module, {
453454
"sethostname" => ctx.new_rustfunc(socket_sethostname),
454455
});

0 commit comments

Comments
 (0)