From 04b50b9f6cd9761fb55da68325f122cd3db19a2f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 13 Feb 2025 06:55:00 -0700 Subject: [PATCH] mux: fix setsockopt invocation for NetBSD refs: https://github.com/wezterm/wezterm/issues/6665 --- mux/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mux/src/lib.rs b/mux/src/lib.rs index f46e5ee08..25c0c70df 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -9,7 +9,7 @@ use config::{configuration, ExitBehavior, GuiPosition}; use domain::{Domain, DomainId, DomainState, SplitSource}; use filedescriptor::{poll, pollfd, socketpair, AsRawSocketDescriptor, FileDescriptor, POLLIN}; #[cfg(unix)] -use libc::{SOL_SOCKET, SO_RCVBUF, SO_SNDBUF}; +use libc::{c_int, SOL_SOCKET, SO_RCVBUF, SO_SNDBUF}; use log::error; use metrics::histogram; use parking_lot::{ @@ -29,7 +29,7 @@ use termwiz::escape::{Action, CSI}; use thiserror::*; use wezterm_term::{Clipboard, ClipboardSelection, DownloadHandler, TerminalSize}; #[cfg(windows)] -use winapi::um::winsock2::{SOL_SOCKET, SO_RCVBUF, SO_SNDBUF}; +use winapi::um::winsock2::{std::os::raw::c_int, SOL_SOCKET, SO_RCVBUF, SO_SNDBUF}; pub mod activity; pub mod client; @@ -241,13 +241,14 @@ fn parse_buffered_data(pane: Weak, dead: &Arc, mut rx: Fil } fn set_socket_buffer(fd: &mut FileDescriptor, option: i32, size: usize) -> anyhow::Result<()> { + let size = size as c_int; let socklen = std::mem::size_of_val(&size); unsafe { let res = libc::setsockopt( fd.as_socket_descriptor(), SOL_SOCKET, option, - &size as *const usize as *const _, + &size as *const c_int as *const _, socklen as _, ); if res == 0 {