- Warning was valid - possible race condition on PTYs. Avoided using
   platform-specific code.
 - Document some common problems
diff --git a/ChangeLog b/ChangeLog
index 4d3e87f..b6c604e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@
      RSA support built in (this is a problem with OpenSSL 0.9.5).
  - Applied pty cleanup patch from markus.friedl@informatik.uni-erlangen.de
  - Avoid warning message with Unix98 ptys
+ - Warning was valid - possible race condition on PTYs. Avoided using 
+   platform-specific code.
+ - Document some common problems
 
 20000207
  - Removed SOCKS code. Will support through a ProxyCommand.
diff --git a/UPGRADING b/UPGRADING
index 8f661cd..c970525 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -103,3 +103,20 @@
 this, select a different cipher in ssh_config or ~/.ssh/config (3des for 
 security or blowfish for speed).
 
+10. "can't locate module net-pf-10" messages in log under Linux
+
+The Linux kernel is looking (via modprobe) for protocol family 10 (IPv6).
+Either 1. load the appropriate kernel module, 2. enter the correct alias
+in /etc/modules.conf or 3. disable IPv6 in /etc/modules.conf.
+
+For some silly reason /etc/modules.conf may also be named /etc/conf.modules
+
+11. Password authentication doesn't work on Slackware 7.0
+
+Configure OpenSSH with --with-md5-passwords
+
+12. ./configure or sshd complain about lack of RSA support
+
+Ensure that your OpenSSL libraries have been built to include RSA support
+either internally or through RSAref.
+
diff --git a/acconfig.h b/acconfig.h
index 9af1117..530c528 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -150,6 +150,9 @@
 /* getaddrinfo is broken (if present) */
 #undef BROKEN_GETADDRINFO
 
+/* Whether Unix98 ptys are automatically removed when they are closed */
+#undef PTY_REMOVED_ON_CLOSE
+
 @BOTTOM@
 
 /* ******************* Shouldn't need to edit below this line ************** */
diff --git a/configure.in b/configure.in
index 1cb4652..e5bdc44 100644
--- a/configure.in
+++ b/configure.in
@@ -55,6 +55,7 @@
 	;;
 *-*-linux*)
 	no_dev_ptmx=1
+	need_pty_removed_on_close=1
 	;;
 *-*-netbsd*)
 	need_dash_r=1
@@ -518,9 +519,27 @@
 fi
 
 if test -z "$no_dev_ptmx" ; then
-	AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX))
+	AC_CHECK_FILE("/dev/ptmx", 
+		[
+			AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
+			have_dev_ptmx=1
+		]
+	)
 fi
-AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC))
+AC_CHECK_FILE("/dev/ptc", 
+	[
+		AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
+		have_dev_ptc=1
+	]
+)
+
+# Some systems (defined in platform-specific code above) automagically remove
+# Unix98 ptys when they are closed
+if test "x$ac_cv_func_openpty" = "xyes" -o "x$have_dev_ptmx" = "x1" -o "x$have_dev_ptc" = "x1" ; then
+	if test "x$need_pty_removed_on_close" = "x1" ; then
+		AC_DEFINE(PTY_REMOVED_ON_CLOSE)
+	fi
+fi
 
 # Options from here on. Some of these are preset by platform above
 
diff --git a/pty.c b/pty.c
index 27e0fe9..4c2dc9c 100644
--- a/pty.c
+++ b/pty.c
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-RCSID("$Id: pty.c,v 1.13 2000/03/02 12:31:50 damien Exp $");
+RCSID("$Id: pty.c,v 1.14 2000/03/02 12:56:13 damien Exp $");
 
 #ifdef HAVE_UTIL_H
 # include <util.h>
@@ -187,10 +187,12 @@
 void 
 pty_release(const char *ttyname)
 {
-	if ((chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) && (errno != ENOENT))
+#ifndef PTY_REMOVED_ON_CLOSE
+	if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0)
 		error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno));
-	if ((chmod(ttyname, (mode_t) 0666) < 0) && (errno != ENOENT))
+	if (chmod(ttyname, (mode_t) 0666) < 0)
 		error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno));
+#endif /* PTY_REMOVED_ON_CLOSE */
 }
 
 /* Makes the tty the processes controlling tty and sets it to sane modes. */