diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-12 06:54:52 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-12 06:54:52 +0000 |
commit | cba4cda71d66a12eeba28b3614b97669218e221c (patch) | |
tree | 09e7eafe36fe42936fff7bd681e425c2432d083d | |
parent | 7587eb706a593f1728fcc0f3c4480856159e5d2a (diff) |
* 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/trunk@29449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win32/win32.c | 15 |
2 files changed, 21 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Tue Oct 12 15:52:35 2010 NAKAMURA Usaku <usa@ruby-lang.org> + + * 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@ruby-lang.org> * io.c (rb_io_ungetc): use unsigned int for GB18030. diff --git a/win32/win32.c b/win32/win32.c index 2dd9d0e023..da4677bc4a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2198,6 +2198,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) |