  
  	int has_attached_client = 0;
  
-@@ -475,6 +607,11 @@ master_process(int s, char **argv, int w
+@@ -475,6 +616,11 @@ master_process(int s, char **argv, int w
  
  	/* Create a pty in which the process is running. */
  	signal(SIGCHLD, die);

 /* Alarm handler for timeout waiting on client connect */
 static void
 	alarm_handler(int sig)
@@ -454,15 +530,71 @@ static void
 	exit(sig);
 }
 

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