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
This commit is contained in:
nobu 2015-07-08 05:05:12 +00:00
parent 601c10e6ec
commit ee750a8a8b
2 changed files with 5 additions and 8 deletions

View File

@ -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;

View File

@ -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