|
38 | 38 | import jnr.ffi.annotations.Out; |
39 | 39 | import jnr.ffi.byref.IntByReference; |
40 | 40 | import jnr.posix.Timeval; |
| 41 | +import jnr.posix.POSIX; |
41 | 42 | import jnr.unixsocket.UnixSocketAddress; |
42 | 43 | import org.jruby.Ruby; |
43 | 44 | import org.jruby.RubyArray; |
@@ -807,8 +808,9 @@ protected IRubyObject getSocknameCommon(ThreadContext context, String caller) { |
807 | 808 | return Sockaddr.pack_sockaddr_in(context, getInetSocketAddress()); |
808 | 809 | } |
809 | 810 |
|
810 | | - if (getUnixSocketAddress() != null) { |
811 | | - return Sockaddr.pack_sockaddr_un(context, getUnixSocketAddress().path()); |
| 811 | + UnixSocketAddress unix = getUnixSocketAddress(); |
| 812 | + if (unix != null) { |
| 813 | + return Sockaddr.pack_sockaddr_un(context, unix.path()); |
812 | 814 | } |
813 | 815 |
|
814 | 816 | return Sockaddr.pack_sockaddr_in(context, 0, "0.0.0.0"); |
@@ -872,10 +874,11 @@ public boolean doNotReverseLookup(ThreadContext context) { |
872 | 874 | } |
873 | 875 |
|
874 | 876 | protected static ChannelFD newChannelFD(Ruby runtime, Channel channel) { |
875 | | - ChannelFD fd = new ChannelFD(channel, runtime.getPosix(), runtime.getFilenoUtil()); |
| 877 | + POSIX posix = runtime.getPosix(); |
| 878 | + ChannelFD fd = new ChannelFD(channel, posix, runtime.getFilenoUtil()); |
876 | 879 |
|
877 | | - if (runtime.getPosix().isNative() && fd.realFileno >= 0 && !Platform.IS_WINDOWS) { |
878 | | - runtime.getPosix().fcntlInt(fd.realFileno, Fcntl.F_SETFD, FcntlLibrary.FD_CLOEXEC); |
| 880 | + if (posix.isNative() && fd.realFileno >= 0 && !Platform.IS_WINDOWS) { |
| 881 | + posix.fcntlInt(fd.realFileno, Fcntl.F_SETFD, FcntlLibrary.FD_CLOEXEC); |
879 | 882 | } |
880 | 883 |
|
881 | 884 | return fd; |
|
0 commit comments