From 0aa741089ec49599d920f9e427924ee054323339 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 19 Jul 2013 17:44:22 +0000 Subject: [PATCH] Add a missing error check in pterm's child-process setup. Shouldn't really fail, but might as well be careful. git-svn-id: svn://svn.tartarus.org/sgt/putty@9931 cda61777-01e9-0310-a592-d414129be87e --- unix/uxpty.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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", -- 2.11.0