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

socketpair() uses AF_UNIX on all non-Linux systems

This commit is contained in:
Nils Nieuwejaar 2022-01-21 18:07:56 +00:00 committed by Wez Furlong
parent 337959f1f4
commit 4705fb96fb

View File

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