From 25f6bcee5494f71d401f7765de62cd2186a2d988 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Wed, 28 Jun 2000 15:21:52 -0700
Subject: [PATCH] support for killing the child process with OOB data

Rev: NT/tools/sprshd:1.20
---
 NT/tools/sprshd | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/NT/tools/sprshd b/NT/tools/sprshd
index 48080213e8..c7d9e5c26f 100755
--- a/NT/tools/sprshd
+++ b/NT/tools/sprshd
@@ -73,16 +73,6 @@ void monitor(object(Stdio.File) io, object proc)
   }
 }
 
-#ifdef WINE
-void my_proxy(Stdio.File from, Stdio.File to)
-{
-  while(string s=from->read(128,1))
-    if(to->write(s)!=strlen(s))
-      return;
-
-}
-#endif
-
 string opt_path(string p1, string p2)
 {
   return  ( ( ((p1||"") + ";" + (p2||"")) / ";" ) - ({""}) ) * ";";
@@ -220,6 +210,14 @@ void handle_incoming_connection(object(Stdio.File) io)
 
     default:
 #ifdef WINE
+      void my_proxy(Stdio.File from, Stdio.File to)
+ 	{	
+	  while(string s=from->read(128,1))
+	    if(to->write(s)!=strlen(s))
+	      return;
+	  if(p) p->kill(9); /* DIE! */
+	}
+
     {
       werror("Proxying.....\n");
       object p3=Stdio.File();
@@ -233,6 +231,22 @@ void handle_incoming_connection(object(Stdio.File) io)
     }
 #endif
 
+#if __VERSION__ >= 0.699999
+       write("Trapping OOB\n");
+   if(io->read_oob)
+   {
+     thread_create(lambda() {
+       while(1)
+       {
+	 string tmp=io->read_oob(1);
+	 if(!tmp || !sizeof(tmp)) return;
+	 werror("**Interrupt received, killing child.\n");
+	 p->kill(9);
+       }
+     });
+   }
+#endif
+
       mixed err=catch {
 	p=Process.create_process(cmd,
 				 ([
-- 
GitLab