Skip to content

Commit

Permalink
Merge pull request #2632 from mhashizume/FACT-3446/main/solaris-socke…
Browse files Browse the repository at this point in the history
…t-descriptors

(FACT-3446) Call close(2) with Solaris FFI
  • Loading branch information
joshcooper authored Oct 26, 2023
2 parents af386f9 + 612c0e7 commit a3d61a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/facter/resolvers/solaris/ffi/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ module Ioctl

attach_function :ioctl_base, :ioctl, %i[int int pointer], :int
attach_function :open_socket, :socket, %i[int int int], :int
attach_function :close_socket, :shutdown, %i[int int], :int
attach_function :close_socket, :close, %i[int], :int
attach_function :inet_ntop, %i[int pointer pointer uint], :string

def self.ioctl(call_const, pointer, address_family = AF_INET)
fd = Ioctl.open_socket(address_family, SOCK_DGRAM, 0)
begin
ioctl_base(fd, call_const, pointer)
ensure
Ioctl.close_socket(fd, 2)
Ioctl.close_socket(fd)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/resolvers/solaris/networking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def add_mtu(lifreq)
ioctl = FFI::Ioctl.ioctl(FFI::SIOCGLIFMTU, lifreq, lifreq.ss_family)

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

Expand Down

0 comments on commit a3d61a3

Please sign in to comment.