summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-08 05:05:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-08 05:05:12 +0000
commitee750a8a8b469f6c022d5096ab287d51a8c1b3de (patch)
treeba365b69254f375018dacec2b8493bcaf453be82
parent601c10e6ec8622e018fda040381d140f8b8574bc (diff)
pass saved errno
* ext/socket/socket.c (socket_s_ip_address_list): pass saved errno to rb_syserr_fail. * ext/readline/readline.c (readline_getc, readline_s_set_input), (readline_s_set_output): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/readline/readline.c9
-rw-r--r--ext/socket/socket.c4
2 files changed, 5 insertions, 8 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 140bd7f..754f981 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -229,8 +229,7 @@ readline_getc(FILE *input)
goto again;
rb_sys_fail("rb_wait_for_single_fd");
}
- errno = data.err;
- rb_sys_fail("read");
+ rb_syserr_fail(data.err, "read");
}
return data.ret;
}
@@ -557,8 +556,7 @@ readline_s_set_input(VALUE self, VALUE input)
if (f == NULL) {
int save_errno = errno;
close(fd);
- errno = save_errno;
- rb_sys_fail("fdopen");
+ rb_syserr_fail(save_errno, "fdopen");
}
rl_instream = readline_rl_instream = f;
readline_instream = input;
@@ -594,8 +592,7 @@ readline_s_set_output(VALUE self, VALUE output)
if (f == NULL) {
int save_errno = errno;
close(fd);
- errno = save_errno;
- rb_sys_fail("fdopen");
+ rb_syserr_fail(save_errno, "fdopen");
}
rl_outstream = readline_rl_outstream = f;
readline_outstream = output;
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 2cda4cb..f1f2907 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1850,7 +1850,7 @@ socket_s_ip_address_list(VALUE self)
errno = save_errno;
if (reason)
- rb_sys_fail(reason);
+ rb_syserr_fail(save_errno, reason);
return list;
#elif defined(SIOCGIFCONF)
@@ -1935,7 +1935,7 @@ socket_s_ip_address_list(VALUE self)
errno = save_errno;
if (reason)
- rb_sys_fail(reason);
+ rb_syserr_fail(save_errno, reason);
return list;
#undef EXTRA_SPACE