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

ruby-changes:17852

From: shyouhei <ko1@a...>
Date: Mon, 22 Nov 2010 16:32:22 +0900 (JST)
Subject: [ruby-changes:17852] Ruby:r29862 (ruby_1_8_7): Fri, 1 Oct 2010 06:13:32 +0000 usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>

shyouhei	2010-11-22 16:22:09 +0900 (Mon, 22 Nov 2010)

  New Revision: 29862

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

  Log:
    Fri, 1 Oct 2010 06:13:32 +0000  usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
     merge revision(s) 29382:
     
     	* win32/win32.c (init_stdhandle): redirect unopened IOs to NUL.
     	  backport r11362 from trunk. [ruby-core:31445]
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
    Signed-off-by: URABE, Shyouhei <shyouhei@r...>

  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/version.h
    branches/ruby_1_8_7/win32/win32.c

Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 29861)
+++ ruby_1_8_7/ChangeLog	(revision 29862)
@@ -1,3 +1,8 @@
+Fri Oct  1 15:12:05 2010  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (init_stdhandle): redirect unopened IOs to NUL.
+	  backport r11362 from trunk. [ruby-core:31445]
+
 Mon Aug 23 11:42:41 2010  NAKAMURA, Hiroshi  <nahi@r...>
 
 	* ext/openssl/ossl_asn1.c (obj_to_asn1bool): fixed ASN1::Boolean
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h	(revision 29861)
+++ ruby_1_8_7/version.h	(revision 29862)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2010-11-22"
 #define RUBY_VERSION_CODE 187
 #define RUBY_RELEASE_CODE 20101122
-#define RUBY_PATCHLEVEL 311
+#define RUBY_PATCHLEVEL 312
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_7/win32/win32.c
===================================================================
--- ruby_1_8_7/win32/win32.c	(revision 29861)
+++ ruby_1_8_7/win32/win32.c	(revision 29862)
@@ -1883,15 +1883,33 @@
 static void
 init_stdhandle(void)
 {
+    int nullfd = -1;
+    int keep = 0;
+#define open_null(fd)						\
+    (((nullfd < 0) ?						\
+      (nullfd = open("NUL", O_RDWR|O_BINARY)) : 0),		\
+     ((nullfd == (fd)) ? (keep = 1) : dup2(nullfd, fd)),	\
+     (fd))
+
     if (fileno(stdin) < 0) {
-	stdin->_file = 0;
+	stdin->_file = open_null(0);
     }
+    else {
+	setmode(fileno(stdin), O_BINARY);
+    }
     if (fileno(stdout) < 0) {
-	stdout->_file = 1;
+	stdout->_file = open_null(1);
     }
+    else {
+	setmode(fileno(stdout), O_BINARY);
+    }
     if (fileno(stderr) < 0) {
-	stderr->_file = 2;
+	stderr->_file = open_null(2);
     }
+    else {
+	setmode(fileno(stderr), O_BINARY);
+    }
+    if (nullfd >= 0 && !keep) close(nullfd);
     setvbuf(stderr, NULL, _IONBF, 0);
 }
 #else

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

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