 Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
 ---
  dtach.h  |    6 -
- main.c   |   27 +++++
- master.c |  331 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------
- 3 files changed, 313 insertions(+), 51 deletions(-)
+ main.c   |   27 ++++
+ master.c |  343 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------
+ 3 files changed, 325 insertions(+), 51 deletions(-)
 
 --- a/dtach.h
 +++ b/dtach.h

+						epoll_ctl(efd, EPOLL_CTL_MOD, peer_pty, &edge_peer);
+						is_edge_mode = 1;
+					}
+					printf("EPOLL HUP\n");
+				}
+				else
+				{
+					close(events[i].data.fd);
+					if (events[i].data.fd == the_pty.fd)
+						exit(1);
+					continue;

 	/* Create the unix domain socket. */
 	s = create_socket(sockname);
 	if (s < 0 && errno == ENAMETOOLONG)
@@ -653,7 +896,7 @@ master_main(char **argv, int waitattach,
 
 	if (dontfork)
 	{
