-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_library_loading.patch
33 lines (29 loc) · 1.24 KB
/
fix_library_loading.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From c983fc99112ad36c8d610db30a6174dee827c531 Mon Sep 17 00:00:00 2001
From: Jay Mundrawala <[email protected]>
Date: Sat, 7 May 2016 21:41:36 +0000
Subject: [PATCH] Fix library loading
find_library will return `None` if it cannot find the library,
and loading `None` means load the current executable. Since find_library
does not check `LD_LIBRARY_PATH`, there is no way to load a library
if it is not in the standard location.
---
yubicommon/ctypes/libloader.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/yubicommon/ctypes/libloader.py b/yubicommon/ctypes/libloader.py
index e1f5d31..98cdf7f 100644
--- a/yubicommon/ctypes/libloader.py
+++ b/yubicommon/ctypes/libloader.py
@@ -163,7 +163,11 @@ class PosixLibraryLoader(LibraryLoader):
def load_library(self, libname, version=None):
try:
- return self.load(ctypes.util.find_library(libname))
+ found_lib = ctypes.util.find_library(libname)
+ if found_lib == None:
+ return self.load(libname)
+ else:
+ return self.load(ctypes.util.find_library(libname))
except ImportError:
return super(PosixLibraryLoader, self).load_library(
libname, version)
--
2.8.0