diff options
author | Liam Middlebrook <lmiddlebrook@nvidia.com> | 2021-06-03 00:08:10 +0300 |
---|---|---|
committer | Liam Middlebrook <liammiddlebrook@gmail.com> | 2021-06-03 00:25:21 +0300 |
commit | cc7ad4bd13bb88ce194270908cc5243b8dc0613a (patch) | |
tree | 29943519c706c7c34d3db4c052dde08045fba513 | |
parent | 91d99ef23694945a6cbed30ff467a16a6257724e (diff) |
proton: Improve find_nvidia_wine_dll_dir() handling of missing filesexperimental-6.3-20210602b
Additionally split out the find_library() logic for discovery of libdl
so that the case of a missing libdl (no matter how unlikely) is caught
before attempting to load an erroneous CDLL.
Fixes: 4881 (Latest Proton Experimental Fails To Open)
Reviewed-by: Adam Moss <amoss@nvidia.com>
-rwxr-xr-x | proton | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -148,10 +148,20 @@ def try_get_game_library_dir(): # # On failure, returns None def find_nvidia_wine_dll_dir(): - libdl = CDLL(find_library("libdl")) - libglx_nvidia = CDLL("libGLX_nvidia.so.0") + try: + libdl_soname = find_library("dl") + + # If we couldn't determine the proper soname for libdl, bail out. + if libdl_soname is None: + return None + + libdl = CDLL(libdl_soname) + except (FileNotFoundError, OSError): + return None - if libdl is None or libglx_nvidia is None: + try: + libglx_nvidia = CDLL("libGLX_nvidia.so.0") + except OSError: return None # from dlinfo(3) |