ruby-changes:5902
From: usa <ko1@a...>
Date: Wed, 18 Jun 2008 18:32:18 +0900 (JST)
Subject: [ruby-changes:5902] Ruby:r17410 (trunk): * win32/win32.c (errmap): add some pipe errors.
usa 2008-06-18 18:32:03 +0900 (Wed, 18 Jun 2008) New Revision: 17410 Modified files: trunk/ChangeLog trunk/win32/win32.c Log: * win32/win32.c (errmap): add some pipe errors. * win32/win32.c (rb_w32_write): set errno when CRT's errno is EINVAL for pipe errors. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/win32/win32.c?r1=17410&r2=17409&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17410&r2=17409&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 17409) +++ ChangeLog (revision 17410) @@ -1,3 +1,10 @@ +Wed Jun 18 18:31:03 2008 NAKAMURA Usaku <usa@r...> + + * win32/win32.c (errmap): add some pipe errors. + + * win32/win32.c (rb_w32_write): set errno when CRT's errno is EINVAL + for pipe errors. + Wed Jun 18 18:09:08 2008 NAKAMURA Usaku <usa@r...> * win32/win32.c (poll_child_status): set EINVAL to errno when Index: win32/win32.c =================================================================== --- win32/win32.c (revision 17409) +++ win32/win32.c (revision 17410) @@ -156,6 +156,14 @@ { ERROR_INFLOOP_IN_RELOC_CHAIN, ENOEXEC }, { ERROR_FILENAME_EXCED_RANGE, ENOENT }, { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, +#ifndef ERROR_PIPE_LOCAL +#define ERROR_PIPE_LOCAL 229L +#endif + { ERROR_PIPE_LOCAL, EPIPE }, + { ERROR_BAD_PIPE, EPIPE }, + { ERROR_PIPE_BUSY, EAGAIN }, + { ERROR_NO_DATA, EPIPE }, + { ERROR_PIPE_NOT_CONNECTED, EPIPE }, { ERROR_NOT_ENOUGH_QUOTA, ENOMEM }, { WSAENAMETOOLONG, ENAMETOOLONG }, { WSAENOTEMPTY, ENOTEMPTY }, @@ -3873,8 +3881,12 @@ { SOCKET sock = TO_SOCKET(fd); - if (!is_socket(sock)) - return write(fd, buf, size); + if (!is_socket(sock)) { + size_t ret = write(fd, buf, size); + if ((int)ret < 0 && errno == EINVAL) + errno = map_errno(GetLastError()); + return ret; + } else return rb_w32_send(fd, buf, size, 0); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/