From 641d5c62ed2bb5fc7ffc27da6ec8d0ea7b288c52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Thu, 9 Apr 1998 15:03:39 -0700
Subject: [PATCH] bugfix

Rev: NT/tools/rntcc:1.13
Rev: src/builtin_functions.c:1.91
Rev: src/modules/call_out/testsuite.in:1.5
Rev: src/modules/files/file.c:1.88
Rev: src/modules/files/testsuite.in:1.14
---
 NT/tools/rntcc                    |  2 ++
 src/builtin_functions.c           |  3 ++-
 src/modules/call_out/testsuite.in |  3 ++-
 src/modules/files/file.c          | 37 ++++++++++++++++---------------
 src/modules/files/testsuite.in    |  2 +-
 5 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/NT/tools/rntcc b/NT/tools/rntcc
index db04355a36..fbaa64b8e9 100755
--- a/NT/tools/rntcc
+++ b/NT/tools/rntcc
@@ -15,6 +15,8 @@ int compile(string *sources,
     dest=reverse(tmp)+".o";
   }
 
+  dest=fixpath(dest);
+
   sources=Array.map(sources,fixpath);
   if(lower_case(sources[0][strlen(sources[0])-3..])==".s")
   {
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 0bdd2fc24c..03cd56cc25 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.90 1998/04/09 20:47:21 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.91 1998/04/09 22:03:39 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -664,6 +664,7 @@ void f_throw(INT32 args)
     error("Too few arguments to throw()\n");
   assign_svalue(&throw_value,sp-args);
   pop_n_elems(args);
+  throw_severity=0;
   pike_throw();
 }
 
diff --git a/src/modules/call_out/testsuite.in b/src/modules/call_out/testsuite.in
index ba0f66b042..ced15233eb 100644
--- a/src/modules/call_out/testsuite.in
+++ b/src/modules/call_out/testsuite.in
@@ -13,4 +13,5 @@ test_true(zero_type(find_call_out(a)))
 test_true(!sizeof(call_out_info()) || function_name(call_out_info()[-1][2])!="a")
 test_do(remove_call_out(call_out_info()[-1][2]))
 test_do(_do_call_outs())
-test_false(Process.system("RUNPIKE SRCDIR/test_co.pike"))
+test_false(Process.system(RUNPIKE+" SRCDIR/test_co.pike"))
+
diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 24ef70235a..5efe337978 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 
 #include "global.h"
-RCSID("$Id: file.c,v 1.87 1998/04/09 03:08:03 hubbe Exp $");
+RCSID("$Id: file.c,v 1.88 1998/04/09 21:55:55 hubbe Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -1861,15 +1861,31 @@ void file_proxy(INT32 args)
 {
   struct my_file *f;
   struct new_thread_data *p;
+  int from, to;
+
   THREAD_T id;
   check_all_args("Stdio.File->proxy",args, BIT_OBJECT,0);
   f=get_file_storage(sp[-args].u.object);
   if(!f)
     error("Bad argument 1 to Stdio.File->proxy, not a Stdio.File object.\n");
 
+  from=fd_dup(f->fd);
+  if(from<0)
+  {
+    ERRNO=errno;
+    error("Failed to dup proxy fd.\n");
+  }
+  to=fd_dup(FD);
+  if(from<0)
+  {
+    ERRNO=errno;
+    fd_close(from);
+    error("Failed to dup proxy fd.\n");
+  }
+  
   p=ALLOC_STRUCT(new_thread_data);
-  p->from=f->fd;
-  p->to=FD;
+  p->from=from;
+  p->to=to;
 
   num_threads++;
   if(th_create_small(&id,proxy_thread,p))
@@ -1878,21 +1894,6 @@ void file_proxy(INT32 args)
     error("Failed to create thread.\n");
   }
 
-  /* Protect ourself from harm */
-  REMOVE_INTERNAL_REFERENCE(f);
-  f->open_mode=0;
-  REMOVE_INTERNAL_REFERENCE(THIS);
-  THIS->open_mode=0;
-  f->fd=-1;
-  FD=-1;
-  set_read_callback(THIS->fd,0,0);
-  set_write_callback(THIS->fd,0,0);
-#ifdef WITH_OOB
-  set_read_oob_callback(THIS->fd,0,0);
-  set_write_oob_callback(THIS->fd,0,0);
-#endif
-  check_internal_reference(THIS);
-
   th_destroy(& id);
   pop_n_elems(args);
   push_int(0);
diff --git a/src/modules/files/testsuite.in b/src/modules/files/testsuite.in
index b64cde919c..54f8bff264 100644
--- a/src/modules/files/testsuite.in
+++ b/src/modules/files/testsuite.in
@@ -129,5 +129,5 @@ cond([[Stdio.File()->lock]],
 
 test_do(rm("conftest"))
 
-test_false(Process.system("RUNPIKE SRCDIR/socktest.pike"))
+test_false(Process.system(RUNPIKE+" SRCDIR/socktest.pike"))
 
-- 
GitLab