From cd504997011c0078df5725ad9b751d05cd83f248 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 2 Dec 2010 08:06:52 +0000 Subject: [PATCH] merges r29449 from trunk into ruby_1_9_2. -- * 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]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ version.h | 2 +- win32/win32.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5eae3c70ba..3ff372676e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 12 15:52:35 2010 NAKAMURA Usaku + + * 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 * io.c (rb_io_ungetc): use unsigned int for GB18030. diff --git a/version.h b/version.h index 00be452c33..b64e339d3d 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 69 +#define RUBY_PATCHLEVEL 70 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 diff --git a/win32/win32.c b/win32/win32.c index 94b67206b8..69547a5534 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2174,6 +2174,21 @@ rb_w32_strerror(int e) 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)