Skip to content

Commit 612c0e7

Browse files
committed
(FACT-3446) Call close(2) with Solaris FFI
Previously, when Facter ran on Solaris it would use shutdown(2) to attempt to close open sockets. However, this would leak file descriptors and occasionally cause an issue where the system would hit its maximum open files. This commit updates Facter to instead use close(2) on Solaris to ensure that file descriptors are not leaked.
1 parent cca2160 commit 612c0e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/facter/resolvers/solaris/ffi/functions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module Ioctl
1010

1111
attach_function :ioctl_base, :ioctl, %i[int int pointer], :int
1212
attach_function :open_socket, :socket, %i[int int int], :int
13-
attach_function :close_socket, :shutdown, %i[int int], :int
13+
attach_function :close_socket, :close, %i[int], :int
1414
attach_function :inet_ntop, %i[int pointer pointer uint], :string
1515

1616
def self.ioctl(call_const, pointer, address_family = AF_INET)
1717
fd = Ioctl.open_socket(address_family, SOCK_DGRAM, 0)
1818
begin
1919
ioctl_base(fd, call_const, pointer)
2020
ensure
21-
Ioctl.close_socket(fd, 2)
21+
Ioctl.close_socket(fd)
2222
end
2323
end
2424
end

0 commit comments

Comments
 (0)