Skip to content

Commit

Permalink
BT: cleanup libc loading (#4278)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 committed Feb 11, 2024
1 parent 5073110 commit bb36cec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scapy/layers/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2533,8 +2533,8 @@ def __init__(self, socket_domain, socket_type, socket_protocol, sock_address):
# the correct parameters. We must call libc functions directly via
# ctypes.
sockaddr_hcip = ctypes.POINTER(sockaddr_hci)
ctypes.cdll.LoadLibrary("libc.so.6")
libc = ctypes.CDLL("libc.so.6")
from ctypes.util import find_library
libc = ctypes.cdll.LoadLibrary(find_library("c"))

socket_c = libc.socket
socket_c.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.c_int)
Expand Down Expand Up @@ -2575,8 +2575,8 @@ def close(self):
return

# Properly close socket so we can free the device
ctypes.cdll.LoadLibrary("libc.so.6")
libc = ctypes.CDLL("libc.so.6")
from ctypes.util import find_library
libc = ctypes.cdll.LoadLibrary(find_library("c"))

close = libc.close
close.restype = ctypes.c_int
Expand Down

0 comments on commit bb36cec

Please sign in to comment.