diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-08 05:05:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-08 05:05:12 +0000 |
commit | 43dc52dd4d168fb32eeda8d56a0cbfedd58b244d (patch) | |
tree | ba365b69254f375018dacec2b8493bcaf453be82 | |
parent | 305265e575af5998a53ca4df7935a1cb8e29ca9f (diff) | |
download | ruby-43dc52dd4d168fb32eeda8d56a0cbfedd58b244d.tar.gz |
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.c | 9 | ||||
-rw-r--r-- | ext/socket/socket.c | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 140bd7f578..754f981c1a 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 2cda4cbaf5..f1f2907b0a 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 |