mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-19 14:45:29 +00:00
macOS: Verify that the pty name from ptsname_r() matches the slave fd
Since the pty name is now obtained from the master fd, check that it refers to the same device as the slave fd, so that a mismatched pair passed to spawn() raises an error instead of silently giving the child the wrong controlling terminal. Also merge the changelog entry into the existing macOS bullet.
This commit is contained in:
parent
57ce719299
commit
db9ae83672
2 changed files with 20 additions and 5 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue