summaryrefslogtreecommitdiff
path: root/missing
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-13 04:15:30 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-13 04:15:30 +0000
commit29b4247ca1fc4a70ca99b1f99fbc552f78780ff0 (patch)
treef97488f1ed3d61c043b8557e388e44613989f0ad /missing
parent6d7ee07a93a78ec7d3e1dcb53395e9b215112460 (diff)
* missing/close.c: keep original errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing')
-rw-r--r--missing/close.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/missing/close.c b/missing/close.c
index 7e743eb204..d87f9e3164 100644
--- a/missing/close.c
+++ b/missing/close.c
@@ -8,12 +8,15 @@ int
ruby_getpeername(int s, struct sockaddr * name,
socklen_t * namelen)
{
+ int err = errno;
errno = 0;
s = getpeername(s, name, namelen);
if (errno == ECONNRESET) {
errno = 0;
s = 0;
}
+ else if (errno == 0)
+ errno = err;
return s;
}
@@ -21,35 +24,44 @@ int
ruby_getsockname(int s, struct sockaddr * name,
socklen_t * namelen)
{
+ int err = errno;
errno = 0;
s = getsockname(s, name, namelen);
if (errno == ECONNRESET) {
errno = 0;
s = 0;
}
+ else if (errno == 0)
+ errno = err;
return s;
}
int
ruby_shutdown(int s, int how)
{
+ int err = errno;
errno = 0;
s = shutdown(s, how);
if (errno == ECONNRESET) {
errno = 0;
s = 0;
}
+ else if (errno == 0)
+ errno = err;
return s;
}
int
ruby_close(int s)
{
+ int err = errno;
errno = 0;
s = close(s);
if (errno == ECONNRESET) {
errno = 0;
s = 0;
}
+ else if (errno == 0)
+ errno = err;
return s;
}