Hi,

In message "Re: sleep is broken with --enable-pthread [Was: Bad interaction between timeout.rb and --enable-pthread]"
    on 04/01/02, Nathaniel Talbott <nathaniel / talbott.ws> writes:

|Unfortunately, it doesn't :-(. My app still dies with the following bug:
|
|   /usr/lib/ruby/1.8/webrick/httprequest.rb:307: [BUG] rb_sys_fail() - 
|errno == 0
|   ruby 1.8.1 (2003-12-25) [i386-linux]
|
|webrick/httprequest.rb line 307 is wrapped in a timeout, so it could be 
|a related problem, but I'm not sure. Any help would be appreciated.

This patch might work.

							matz.

--- rubysig.h	24 Dec 2003 08:47:36 -0000	1.18
+++ rubysig.h	2 Jan 2004 17:37:21 -0000
@@ -44,2 +44,4 @@ typedef int rb_atomic_t;
 # define TRAP_BEG do {\
+    extern int errno;\
+    int saved_errno = 0;\
     int trap_immediate = rb_trap_immediate;\
@@ -47,3 +49,5 @@ typedef int rb_atomic_t;
 # define TRAP_END rb_trap_immediate = trap_immediate;\
-  CHECK_INTS;\
+    saved_errno = errno;\
+    CHECK_INTS;\
+    errno = saved_errno;\
 } while (0)