]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add a missing error check in pterm's child-process setup. Shouldn't
authorSimon Tatham <anakin@pobox.com>
Fri, 19 Jul 2013 17:44:22 +0000 (17:44 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 19 Jul 2013 17:44:22 +0000 (17:44 +0000)
really fail, but might as well be careful.

[originally from svn r9931]

unix/uxpty.c

index 5ebd05047746199aeccdc3d3bb5daa044d36bb15..4a606efda87e4f40df787777303c918c5d974fda 100644 (file)
@@ -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",