- (stevesk) don't set SA_RESTART and set SIGCHLD to SIG_DFL
   around grantpt().
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;