X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/6db084b8b35c8dc4b510caef60f52aa02ceebcbf..f7aa4b367eaf2c1e928f97263bcf4da74680aff3:/unix/uxpty.c diff --git a/unix/uxpty.c b/unix/uxpty.c index 5ebd0504..4a606efd 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -820,7 +820,11 @@ static const char *pty_init(void *frontend, void **backend_handle, Conf *conf, pgrp = getpid(); tcsetpgrp(0, pgrp); setpgid(pgrp, pgrp); - close(open(pty->name, O_WRONLY, 0)); + { + int ptyfd = open(pty->name, O_WRONLY, 0); + if (ptyfd >= 0) + close(ptyfd); + } setpgid(pgrp, pgrp); { char *term_env_var = dupprintf("TERM=%s",