=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshd.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- src/usr.bin/ssh/sshd.c 2000/01/27 20:20:02 1.82 +++ src/usr.bin/ssh/sshd.c 2000/01/31 23:57:01 1.83 @@ -11,7 +11,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.82 2000/01/27 20:20:02 markus Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.83 2000/01/31 23:57:01 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -1982,6 +1982,7 @@ const char *auth_data) { int pid, fdout; + int ptymaster; const char *hostname; time_t last_login_time; char buf[100], *time_string; @@ -2111,8 +2112,13 @@ */ fdout = dup(ptyfd); if (fdout < 0) - packet_disconnect("dup failed: %.100s", strerror(errno)); + packet_disconnect("dup #1 failed: %.100s", strerror(errno)); + /* we keep a reference to the pty master */ + ptymaster = dup(ptyfd); + if (ptymaster < 0) + packet_disconnect("dup #2 failed: %.100s", strerror(errno)); + /* * Add a cleanup function to clear the utmp entry and record logout * time in case we call fatal() (e.g., the connection gets closed). @@ -2139,8 +2145,8 @@ * the pty cleanup, so that another process doesn't get this pty * while we're still cleaning up. */ - close(ptyfd); - close(fdout); + if (close(ptymaster) < 0) + error("close(ptymaster): %s", strerror(errno)); } /*