From 9a6da48abb669efa44c40a0a9880f03e2c3acde3 Mon Sep 17 00:00:00 2001 From: Nikhil Choudhary Date: Fri, 13 Feb 2026 14:33:43 +0100 Subject: [PATCH] Fix segfault building on macOS 12+ with deployment target <=11 --- libserialport_internal.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libserialport_internal.h b/libserialport_internal.h index 57346d6..3f94ec8 100644 --- a/libserialport_internal.h +++ b/libserialport_internal.h @@ -93,9 +93,10 @@ #include #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000 /* Before macOS 12 */ -#define kIOMainPortDefault kIOMasterPortDefault -#endif +/* kIOMainPortDefault (kIOMasterPortDefault <= macOS 11) is a + * synonym for NULL. Fixes segfault when building on macOS 12+ + * with an older macOS deployment target. */ +#define kIOMainPortDefault 0 #endif #ifdef __linux__ #include