- (stevesk) don't set SA_RESTART and set SIGCHLD to SIG_DFL
   around grantpt().
diff --git a/ChangeLog b/ChangeLog
index a8a1535..956bddc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20010615
+ - (stevesk) don't set SA_RESTART and set SIGCHLD to SIG_DFL
+   around grantpt().
+
 20010614
  - OpenBSD CVS Sync
    - markus@cvs.openbsd.org 2001/06/13 09:10:31
@@ -5644,4 +5648,4 @@
  - Wrote replacements for strlcpy and mkdtemp
  - Released 1.0pre1
 
-$Id: ChangeLog,v 1.1286 2001/06/13 19:23:32 mouring Exp $
+$Id: ChangeLog,v 1.1287 2001/06/15 00:04:23 stevesk Exp $
diff --git a/misc.c b/misc.c
index 208819c..5e98b8b 100644
--- a/misc.c
+++ b/misc.c
@@ -280,10 +280,6 @@
 		memset(&sa, 0, sizeof(sa));
 		sigemptyset(&sa.sa_mask);
 		sa.sa_flags = 0;
-#if defined(SA_RESTART)
-		if (sig == SIGCHLD)
-			sa.sa_flags |= SA_RESTART;
-#endif
 #if defined(SA_INTERRUPT)
 		if (sig == SIGALRM)
 			sa.sa_flags |= SA_INTERRUPT;
diff --git a/sshpty.c b/sshpty.c
index 4af55e9..4083e24 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -20,6 +20,7 @@
 
 #include "sshpty.h"
 #include "log.h"
+#include "misc.h"
 
 /* Pty allocated with _getpty gets broken if we do I_PUSH:es to it. */
 #if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY)
@@ -93,16 +94,19 @@
 	 */
 	int ptm;
 	char *pts;
+	mysig_t old_signal;
 
 	ptm = open("/dev/ptmx", O_RDWR | O_NOCTTY);
 	if (ptm < 0) {
 		error("/dev/ptmx: %.100s", strerror(errno));
 		return 0;
 	}
+	old_signal = mysignal(SIGCHLD, SIG_DFL);
 	if (grantpt(ptm) < 0) {
 		error("grantpt: %.100s", strerror(errno));
 		return 0;
 	}
+	mysignal(SIGCHLD, old_signal);
 	if (unlockpt(ptm) < 0) {
 		error("unlockpt: %.100s", strerror(errno));
 		return 0;