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:
parent
56e9a9af7e
commit
337959f1f4
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user