mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
merges r28561 from trunk into ruby_1_9_2.
-- * missing/close.c: ignore ECONNRESET. FreeBSD wrongly sets ECONNRESET on close(2) and it causes false-negative exceptions. [ruby-dev:41778] * configure.in: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aa1fdb9053
commit
f813b7dc1a
4 changed files with 80 additions and 1 deletions
55
missing/close.c
Normal file
55
missing/close.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* Ignore ECONNRESET of FreeBSD */
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int
|
||||
ruby_getpeername(int s, struct sockaddr * name,
|
||||
socklen_t * namelen)
|
||||
{
|
||||
errno = 0;
|
||||
s = getpeername(s, name, namelen);
|
||||
if (errno == ECONNRESET) {
|
||||
errno = 0;
|
||||
s = 0;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
ruby_getsockname(int s, struct sockaddr * name,
|
||||
socklen_t * namelen)
|
||||
{
|
||||
errno = 0;
|
||||
s = getsockname(s, name, namelen);
|
||||
if (errno == ECONNRESET) {
|
||||
errno = 0;
|
||||
s = 0;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
ruby_shutdown(int s, int how)
|
||||
{
|
||||
errno = 0;
|
||||
s = shutdown(s, how);
|
||||
if (errno == ECONNRESET) {
|
||||
errno = 0;
|
||||
s = 0;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
ruby_close(int s)
|
||||
{
|
||||
errno = 0;
|
||||
s = close(s);
|
||||
if (errno == ECONNRESET) {
|
||||
errno = 0;
|
||||
s = 0;
|
||||
}
|
||||
return s;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue