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

ruby-changes:17444

From: usa <ko1@a...>
Date: Tue, 12 Oct 2010 15:55:00 +0900 (JST)
Subject: [ruby-changes:17444] Ruby:r29449 (trunk): * win32/win32.c (rb_w32_strerror): unmap some range of errno for

usa	2010-10-12 15:54:52 +0900 (Tue, 12 Oct 2010)

  New Revision: 29449

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

  Log:
    * win32/win32.c (rb_w32_strerror): unmap some range of errno for
      workaround of VC10's strerror() and sys_nerr problem.
      based on a patch from Akio Tajima, [ruby-dev:42355].

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29448)
+++ ChangeLog	(revision 29449)
@@ -1,3 +1,9 @@
+Tue Oct 12 15:52:35 2010  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (rb_w32_strerror): unmap some range of errno for
+	  workaround of VC10's strerror() and sys_nerr problem.
+	  based on a patch from Akio Tajima, [ruby-dev:42355].
+
 Tue Oct 12 15:36:09 2010  NARUSE, Yui  <naruse@r...>
 
 	* io.c (rb_io_ungetc): use unsigned int for GB18030.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 29448)
+++ win32/win32.c	(revision 29449)
@@ -2198,6 +2198,21 @@
     if (e < 0 || e > sys_nerr) {
 	if (e < 0)
 	    e = GetLastError();
+#if WSAEWOULDBLOCK != EWOULDBLOCK
+	else if (e >= EADDRINUSE && e <= EWOULDBLOCK) {
+	    static int s = -1;
+	    int i;
+	    if (s < 0)
+		for (s = 0; s < (int)(sizeof(errmap)/sizeof(*errmap)); s++)
+		    if (errmap[s].winerr == WSAEWOULDBLOCK)
+			break;
+	    for (i = s; i < (int)(sizeof(errmap)/sizeof(*errmap)); i++)
+		if (errmap[i].err == e) {
+		    e = errmap[i].winerr;
+		    break;
+		}
+	}
+#endif
 	if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
 			  FORMAT_MESSAGE_IGNORE_INSERTS, &source, e, 0,
 			  buffer, sizeof(buffer), NULL) == 0)

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

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