  	}
  }
  
-@@ -589,12 +801,43 @@ master_main(char **argv, int waitattach,
+@@ -589,12 +815,46 @@ master_main(char **argv, int waitattach,
  {
  	int fd[2] = {-1, -1};
  	int s;

 #ifdef BROKEN_MASTER
 	/* Get the current terminal settings. */
 	if (tcgetattr(the_pty.slave, &the_pty.term) < 0)
@@ -293,8 +329,6 @@ top:
 	/* Send the data out to the clients. */
 	for (p = clients, nclients = 0; p; p = p->next)
 	{

 
 #ifndef HAVE_FORKPTY
 pid_t forkpty(int *amaster, char *name, struct termios *termp,
 	struct winsize *winp);
 #endif
 
+/* Handle EINTR write */
+static void
+eintr_write(int fd, const void *buf, ssize_t len)
+{
+	ssize_t n;
+
+again:
+	n = write(fd, buf, len);
+
+
+	if (n < 0 && errno == EINTR)
+		goto again;
+}
+
 /* Unlink the socket */
 static void
 unlink_socket(void)
 {
 	unlink(sockname);
