Skip to content

Conversation

@Patrick-Beuks
Copy link

This PR cleans up all file descriptors correctly as the before low_fds[0] could never be closed due to the count > 0 condition.

This makes it so that if the slave exits all tty descriptors can be cleaned.

Before this change the tty descriptors would keep increasing until the sysctl kern.tty.ptmx_max limit and closing terminals would not make possible to create new terminals.

This also fixes a logic error in that res = grantpt(*master) || unlockpt(*master); could never be -1

Note:
While this solves the issue with tty descriptors on successful creation, it can still leak descriptors when it fails before errors got to the done label. I tried adding a cleanup step on errors, but could not get it working in the time allotted to fix this problem.

@deepak1556 deepak1556 self-assigned this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants