Skip to content

Commit 43730cb

Browse files
committed
don't call ctypes.util.find_library on non-sonames
If IPTABLES_LIBDIR is given, we will pass potential paths to _do_find_library. In this case, calling ctypes.util.find_library is not helpful, and we should simply try to load the library directly.
1 parent 583f939 commit 43730cb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

iptc/util.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ def load_kernel(name, exc_if_failed=False):
5252

5353

5454
def _do_find_library(name):
55+
if '/' in name:
56+
try:
57+
return ctypes.CDLL(name, mode=ctypes.RTLD_GLOBAL)
58+
except Exception:
59+
return None
5560
p = ctypes.util.find_library(name)
5661
if p:
5762
lib = ctypes.CDLL(p, mode=ctypes.RTLD_GLOBAL)

0 commit comments

Comments
 (0)