Skip to content

Commit a3d61a3

Browse files
authored
Merge pull request #2632 from mhashizume/FACT-3446/main/solaris-socket-descriptors
(FACT-3446) Call close(2) with Solaris FFI
2 parents af386f9 + 612c0e7 commit a3d61a3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

+2-2
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

lib/facter/resolvers/solaris/networking.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def add_mtu(lifreq)
7979
ioctl = FFI::Ioctl.ioctl(FFI::SIOCGLIFMTU, lifreq, lifreq.ss_family)
8080

8181
if ioctl == -1
82-
@log.error("Cold not read MTU, error code is #{::FFI::LastError.error}")
82+
@log.error("Could not read MTU, error code is: #{::FFI::LastError.error}")
8383
return
8484
end
8585

0 commit comments

Comments
 (0)