mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
32c63d1f35
commit
ad24701cce
2 changed files with 21 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Jun 18 18:31:03 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (poll_child_status): set EINVAL to errno when
|
||||
|
|
|
@ -156,6 +156,14 @@ static struct {
|
|||
{ 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 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue