Skip to content

Commit 1a434f6

Browse files
Many OSs have only libz.so.1 but no libz.so, so when loading zlib, want to check both and load libz.so.1 first, and then double check libz.so if that fails.
1 parent 2391f54 commit 1a434f6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/pkg_editor/src/zlib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ static void *zlib_load_library() {
8686
void *const library = (void *)LoadLibraryA(WINDOWS_ZLIB_PATH);
8787
return library;
8888
#else
89-
return dlopen("libz.so", RTLD_NOW);
89+
void *dlopen_handle = (void *)dlopen("libz.so.1", RTLD_NOW);
90+
if ( dlopen_handle == NULL ) {
91+
return dlopen("libz.so", RTLD_NOW);
92+
} else {
93+
return dlopen_handle;
94+
}
9095
#endif
9196
}
9297

0 commit comments

Comments
 (0)