This project is closed and read-only.
Actions
Backport #4132
closedSocket.close attempting to close the socket twice
Backport #4132:
Socket.close attempting to close the socket twice
Status:
Closed
Assignee:
-
Description
=begin
Socket.close calls shutdown twice on the same file descriptor
socktest.rb¶
require 'socket'
include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
socket.bind( sockaddr )
socket.listen( 5 )
puts "socket.to_i: #{socket.to_i}"
socket.close
#############
$ strace -e trace=open,close ruby1.8 socktest.rb
...
socket.to_i: 3
close(3) = 0
close(3) = -1 EBADF (Bad file descriptor)
socket.c¶
socks_s_close(sock)
...
1386 shutdown(fileno(fptr->f), 2);
1387 shutdown(fileno(fptr->f2), 2);
=end
Actions