ruby-changes:38545
From: nagachika <ko1@a...>
Date: Sun, 24 May 2015 03:32:16 +0900 (JST)
Subject: [ruby-changes:38545] nagachika:r50626 (ruby_2_2): merge revision(s) 50404, 50405: [Backport #10975]
nagachika 2015-05-24 03:31:26 +0900 (Sun, 24 May 2015) New Revision: 50626 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50626 Log: merge revision(s) 50404,50405: [Backport #10975] * ext/socket/ipsocket.c (init_inetsock_internal): preserve errno before other library calls and use rb_syserr_fail. [ruby-core:68531] [Bug #10975] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/ext/socket/ipsocket.c branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 50625) +++ ruby_2_2/ChangeLog (revision 50626) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sun May 24 03:06:20 2015 Nobuyoshi Nakada <nobu@r...> + + * ext/socket/ipsocket.c (init_inetsock_internal): preserve errno + before other library calls and use rb_syserr_fail. + [ruby-core:68531] [Bug #10975] + Sun May 24 03:01:17 2015 Nobuyoshi Nakada <nobu@r...> * ext/-test-/printf/printf.c (uint_to_str): renamed to get rid of Index: ruby_2_2/ext/socket/ipsocket.c =================================================================== --- ruby_2_2/ext/socket/ipsocket.c (revision 50625) +++ ruby_2_2/ext/socket/ipsocket.c (revision 50626) @@ -41,6 +41,7 @@ inetsock_cleanup(struct inetsock_arg *ar https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/ipsocket.c#L41 static VALUE init_inetsock_internal(struct inetsock_arg *arg) { + int error = 0; int type = arg->type; struct addrinfo *res, *lres; int fd, status = 0, local = 0; @@ -80,6 +81,7 @@ init_inetsock_internal(struct inetsock_a https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/ipsocket.c#L81 syscall = "socket(2)"; fd = status; if (fd < 0) { + error = errno; continue; } arg->fd = fd; @@ -107,6 +109,7 @@ init_inetsock_internal(struct inetsock_a https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/ipsocket.c#L109 } if (status < 0) { + error = errno; close(fd); arg->fd = fd = -1; continue; @@ -124,7 +127,7 @@ init_inetsock_internal(struct inetsock_a https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/ipsocket.c#L127 port = arg->remote.serv; } - rsock_sys_fail_host_port(syscall, host, port); + rsock_syserr_fail_host_port(error, syscall, host, port); } arg->fd = -1; @@ -132,8 +135,9 @@ init_inetsock_internal(struct inetsock_a https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/ipsocket.c#L135 if (type == INET_SERVER) { status = listen(fd, SOMAXCONN); if (status < 0) { + error = errno; close(fd); - rb_sys_fail("listen(2)"); + rb_syserr_fail(error, "listen(2)"); } } Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 50625) +++ ruby_2_2/version.h (revision 50626) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.3" #define RUBY_RELEASE_DATE "2015-05-24" -#define RUBY_PATCHLEVEL 122 +#define RUBY_PATCHLEVEL 123 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 5 Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50404-50405 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/