iucvterm/iucvtty: Close PTY slave fd after fork

The PTY slave file descriptor is the controlling terminal
allocated for the child process.  When all file descriptors
are being closed, a SIGHUP is triggered for the child process.

Keeping the file descriptor in the parent open would prevent
the SIGHUP to be delivered to the child process.

For proper SIGHUP processing, close the file descriptor in
the parent process.

Acked-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Hendrik Brueckner
2026-07-06 11:39:52 +02:00
committed by Jan Höppner
parent c85b4e54dd
commit a69a46eafd

View File

@@ -123,6 +123,9 @@ static int iucvtty_worker(int client, int master, int slave,
exit(3); /* we only reach here if exec has failed */
}
/* Close slave fd to properly handle SIGHUP for the child process */
close(slave);
/* setup buffers */
msg = malloc(MSG_BUFFER_SIZE);
if (msg == NULL) {