ruby-changes:39111
From: nobu <ko1@a...>
Date: Wed, 8 Jul 2015 14:05:29 +0900 (JST)
Subject: [ruby-changes:39111] nobu:r51192 (trunk): pass saved errno
nobu 2015-07-08 14:05:12 +0900 (Wed, 08 Jul 2015) New Revision: 51192 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51192 Log: 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. Modified files: trunk/ext/readline/readline.c trunk/ext/socket/socket.c Index: ext/readline/readline.c =================================================================== --- ext/readline/readline.c (revision 51191) +++ ext/readline/readline.c (revision 51192) @@ -229,8 +229,7 @@ readline_getc(FILE *input) https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L229 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 i https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L556 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 https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L592 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; Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 51191) +++ ext/socket/socket.c (revision 51192) @@ -1850,7 +1850,7 @@ socket_s_ip_address_list(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1850 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) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1935 errno = save_errno; if (reason) - rb_sys_fail(reason); + rb_syserr_fail(save_errno, reason); return list; #undef EXTRA_SPACE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/