From 4528173ff589ba91990f2c6fe03205f321add683 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 10 Mar 2022 07:37:57 +0530 Subject: [PATCH] Max length for SHM names on Apple is 30! Bloody CrApple --- kitty/data-types.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kitty/data-types.c b/kitty/data-types.c index 3af625b5a..f4d795c11 100644 --- a/kitty/data-types.c +++ b/kitty/data-types.c @@ -341,10 +341,14 @@ PyInit_fast_data_types(void) { PyModule_AddIntMacro(m, APC); PyModule_AddIntMacro(m, OSC); PyModule_AddIntMacro(m, FILE_TRANSFER_CODE); - // FreeBSD's man page says this is 1023. Linux says its PATH_MAX. +#ifdef __APPLE__ // Apple says its SHM_NAME_MAX but SHM_NAME_MAX is not actually declared in typical CrApple style. - // Experimentation shows that 1023 is allowed on macOS Catalina + // This value is based on experimentation + PyModule_AddIntConstant(m, "SHM_NAME_MAX", 30); +#else + // FreeBSD's man page says this is 1023. Linux says its PATH_MAX. PyModule_AddIntConstant(m, "SHM_NAME_MAX", MIN(1023, PATH_MAX)); +#endif return m; }