[前][次][番号順一覧][スレッド一覧]

ruby-changes:15968

From: shyouhei <ko1@a...>
Date: Thu, 20 May 2010 15:45:34 +0900 (JST)
Subject: [ruby-changes:15968] Ruby:r27913 (ruby_1_8_7): merge revision(s) 26253:

shyouhei	2010-05-20 15:45:22 +0900 (Thu, 20 May 2010)

  New Revision: 27913

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27913

  Log:
    merge revision(s) 26253:
    * io.c (io_fwrite): preserve errno.  [ruby-core:27425]

  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/io.c
    branches/ruby_1_8_7/test/ruby/test_pipe.rb
    branches/ruby_1_8_7/version.h

Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 27912)
+++ ruby_1_8_7/ChangeLog	(revision 27913)
@@ -1,3 +1,7 @@
+Thu May 20 15:39:26 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (io_fwrite): preserve errno.  [ruby-core:27425]
+
 Tue Apr 20 08:04:37 2010  NAKAMURA Usaku  <usa@r...>
 
 	* io.c (rb_io_s_read): close the IO if an exception is raised on
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h	(revision 27912)
+++ ruby_1_8_7/version.h	(revision 27913)
@@ -1,14 +1,14 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2010-04-20"
+#define RUBY_RELEASE_DATE "2010-05-20"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20100420
-#define RUBY_PATCHLEVEL 254
+#define RUBY_RELEASE_CODE 20100520
+#define RUBY_PATCHLEVEL 255
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2010
-#define RUBY_RELEASE_MONTH 4
+#define RUBY_RELEASE_MONTH 5
 #define RUBY_RELEASE_DAY 20
 
 #ifdef RUBY_EXTERN
Index: ruby_1_8_7/io.c
===================================================================
--- ruby_1_8_7/io.c	(revision 27912)
+++ ruby_1_8_7/io.c	(revision 27913)
@@ -120,6 +120,9 @@
 # endif
 #endif
 
+#define preserving_errno(stmts) \
+	do {int saved_errno = errno; stmts; errno = saved_errno;} while (0)
+
 VALUE rb_cIO;
 VALUE rb_eEOFError;
 VALUE rb_eIOError;
@@ -488,7 +491,7 @@
 	r = write(fileno(f), RSTRING(str)->ptr+offset, l);
         TRAP_END;
 #if BSD_STDIO
-	fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET);
+	preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET));
 #endif
         if (r == n) return len;
         if (0 <= r) {
Index: ruby_1_8_7/test/ruby/test_pipe.rb
===================================================================
--- ruby_1_8_7/test/ruby/test_pipe.rb	(revision 27912)
+++ ruby_1_8_7/test/ruby/test_pipe.rb	(revision 27913)
@@ -15,4 +15,18 @@
       r.close
     end
   end
+
+  def test_write
+    bug2559 = '[ruby-core:27425]'
+    a, b = IO.pipe
+    begin
+      a.close
+      assert_raises(Errno::EPIPE, bug2559) do
+        b.write("hi")
+      end
+    ensure
+      a.close if !a.closed?
+      b.close if !b.closed?
+    end
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]