1
1
mirror of https://github.com/wez/wezterm.git synced 2024-08-17 10:10:23 +03:00

fix socketpair() implementation to build on Illumos

This commit is contained in:
Nils Nieuwejaar 2022-01-20 16:56:01 -05:00 committed by Wez Furlong
parent 56e9a9af7e
commit 337959f1f4

View File

@ -392,7 +392,12 @@ pub fn socketpair_impl() -> Result<(FileDescriptor, FileDescriptor)> {
#[doc(hidden)]
pub fn socketpair_impl() -> Result<(FileDescriptor, FileDescriptor)> {
let mut fds = [-1i32; 2];
let res = unsafe { libc::socketpair(libc::PF_LOCAL, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) };
#[cfg(target_os = "illumos")]
let domain = libc::AF_UNIX;
#[cfg(not(target_os = "illumos"))]
let domain = libc::PF_LOCAL;
let res = unsafe { libc::socketpair(domain, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) };
if res == -1 {
Err(Error::Socketpair(std::io::Error::last_os_error()))
} else {