diff --git a/docs/changelog.rst b/docs/changelog.rst index 897183902..cdeeec1ae 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -436,11 +436,10 @@ Detailed list of changes :pull:`10721`) - macOS: Fix padding rendering black after sleep, OS windows not staying on all - spaces, a duplicate path when dropping items from Apple Mail and a memory - leak (:iss:`10708`, :iss:`10581`, :iss:`10628`, :iss:`10673`) - -- macOS: Fix kitty freezing when opening a new window while another entry in - :file:`/dev` is stuck (:iss:`10741`) + spaces, a duplicate path when dropping items from Apple Mail, a memory + leak and kitty freezing when opening a new window while another entry in + :file:`/dev` is stuck (:iss:`10708`, :iss:`10581`, :iss:`10628`, + :iss:`10673`, :iss:`10741`) 0.49.2 [2026-10-01] diff --git a/kitty/child.c b/kitty/child.c index 77b6f89dc..88f423002 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -120,6 +120,22 @@ spawn(PyObject *self UNUSED, PyObject *args) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } +#ifdef __APPLE__ + // The name came from master, ensure it refers to the same pty as slave + struct stat slave_st, name_st; + if (fstat(slave, &slave_st) != 0) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } + if (stat(name, &name_st) != 0) { + PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); + return NULL; + } + if (slave_st.st_rdev != name_st.st_rdev) { + PyErr_Format(PyExc_ValueError, "The slave fd %d is not the pty of the master fd %d (%s)", slave, master, name); + return NULL; + } +#endif char **argv = serialize_string_tuple(argv_p, 0); if (!argv) return NULL; char **env = serialize_string_tuple(env_p, 1);