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

ruby-changes:12033

From: matz <ko1@a...>
Date: Tue, 16 Jun 2009 10:14:42 +0900 (JST)
Subject: [ruby-changes:12033] Ruby:r23699 (trunk): * io.c (fptr_finalize): should close stdin/stdout/stderr when

matz	2009-06-16 10:14:28 +0900 (Tue, 16 Jun 2009)

  New Revision: 23699

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

  Log:
    * io.c (fptr_finalize): should close stdin/stdout/stderr when
      closed explicitly.   [ruby-core:23853]
    * io.c (argf_skip): should close only when current_file is available.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23698)
+++ ChangeLog	(revision 23699)
@@ -1,3 +1,10 @@
+Tue Jun 16 06:40:31 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* io.c (fptr_finalize): should close stdin/stdout/stderr when
+	  closed explicitly.   [ruby-core:23853]
+
+	* io.c (argf_skip): should close only when current_file is available.
+
 Tue Jun 16 01:50:02 2009  Tanaka Akira  <akr@f...>
 
 	* vm_eval.c (rb_call0): refine exception message for hidden objects.
Index: io.c
===================================================================
--- io.c	(revision 23698)
+++ io.c	(revision 23699)
@@ -3221,7 +3221,7 @@
         if (io_fflush(fptr) < 0 && NIL_P(err))
             err = noraise ? Qtrue : INT2NUM(errno);
     }
-    if (IS_PREP_STDIO(fptr) || fptr->fd <= 2) {
+    if (noraise && (IS_PREP_STDIO(fptr) || fptr->fd <= 2)) {
         goto check_err;
     }
     if (fptr->stdio_file) {
@@ -8473,7 +8473,7 @@
 static VALUE
 argf_skip(VALUE argf)
 {
-    if (ARGF.next_p != -1) {
+    if (ARGF.init_p && ARGF.next_p == 0) {
 	argf_close(ARGF.current_file);
 	ARGF.next_p = 1;
     }

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

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