1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Close standard handles in watchdog subprocesses.

Naturally, there's one really glaring goof I find out instants after
'git push'! If Pageant starts a watchdog subprocess which will wait
until the main process terminates and then clean up the socket, then
it had better not have that subprocess keep the standard I/O handles
open, or else commands like eval $(pageant -X) won't terminate.

I've applied the same fix in the X11 socket creation, though I think
it's less critical there.
This commit is contained in:
Simon Tatham 2018-10-21 10:14:22 +01:00
parent a081dd0a4c
commit aa162bbca1
2 changed files with 10 additions and 0 deletions

View File

@ -159,6 +159,11 @@ int platform_make_x11_server(Plug *plug, const char *progname, int mindisp,
* we expect read() to return EOF as soon as
* that process terminates.
*/
close(0);
close(1);
close(2);
setpgid(0, 0);
close(cleanup_pipe[1]);
close(authfd);

View File

@ -62,6 +62,11 @@ Socket *platform_make_agent_socket(
* we expect read() to return EOF as soon as
* that process terminates.
*/
close(0);
close(1);
close(2);
setpgid(0, 0);
close(cleanup_pipe[1]);
while (read(cleanup_pipe[0], buf, sizeof(buf)) > 0);