File sendfdcont.diff of Package screen.38894

--- attacher.c.orig	2013-04-08 15:46:35.000000000 +0000
+++ attacher.c	2025-05-28 10:55:27.300087054 +0000
@@ -105,7 +105,7 @@ QueryResultFail SIGDEFARG
  *  Understands  MSG_ATTACH, MSG_DETACH, MSG_POW_DETACH
  *               MSG_CONT, MSG_WINCH and nothing else!
  *
- *  if type == MSG_ATTACH and sockets are used, attaches
+ *  if type == MSG_ATTACH or MSG_CONT and sockets are used, attaches
  *  tty filedescriptor.
  */
 
@@ -117,7 +117,7 @@ struct msg *m;
   int r, l = sizeof(*m);
 
 #ifndef NAMEDPIPE
-  if (m->type == MSG_ATTACH)
+  if (m->type == MSG_ATTACH || m->type == MSG_CONT)
     return SendAttachMsg(s, m, attach_fd);
 #endif
 
--- socket.c.orig	2013-04-08 15:46:35.000000000 +0000
+++ socket.c	2025-05-28 10:56:20.839995636 +0000
@@ -1082,7 +1082,7 @@ ReceiveMsg()
     }
 
   debug2("*** RecMsg: type %d tty %s\n", m.type, m.m_tty);
-  if (m.type != MSG_ATTACH && recvfd != -1)
+  if (m.type != MSG_ATTACH && m.type != MSG_CONT && recvfd != -1)
     {
       close(recvfd);
       recvfd = -1;
@@ -1133,7 +1133,11 @@ ReceiveMsg()
       break;
     case MSG_CONT:
 	if (display && D_userpid != 0 && kill(D_userpid, 0) == 0)
-	  break;		/* Intruder Alert */
+	  {
+	    if (recvfd != -1)
+	      close(recvfd);
+	    break;		/* Intruder Alert */
+	  }
       debug2("RecMsg: apid=%d,was %d\n", m.m.attach.apid, display ? D_userpid : 0);
       /* FALLTHROUGH */
 
openSUSE Build Service is sponsored by