aboutsummaryrefslogtreecommitdiff
path: root/flatpak/patches/weird_libdecor.patch
blob: 3a400b820f8433c3742643914f01e315df1dbb6f (plain)
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
33
34
35
36
37
38
39
40
diff --git a/src/libdecor.c b/src/libdecor.c
index a9c1106..1aa38b3 100644
--- a/src/libdecor.c
+++ b/src/libdecor.c
@@ -1391,22 +1391,32 @@ calculate_priority(const struct libdecor_plugin_description *plugin_description)
 static bool
 check_symbol_conflicts(const struct libdecor_plugin_description *plugin_description)
 {
+	bool ret = true;
 	char * const *symbol;
+	void* main_prog = dlopen(NULL, RTLD_LAZY);
+	if (!main_prog) {
+		fprintf(stderr, "Plugin \"%s\" couldn't check conflicting symbols: \"%s\".\n",
+					plugin_description->description, dlerror());
+		return false;
+	}
+
 
 	symbol = plugin_description->conflicting_symbols;
 	while (*symbol) {
 		dlerror();
-		dlsym (RTLD_DEFAULT, *symbol);
+		dlsym (main_prog, *symbol);
 		if (!dlerror()) {
 			fprintf(stderr, "Plugin \"%s\" uses conflicting symbol \"%s\".\n",
 					plugin_description->description, *symbol);
-			return false;
+			ret = false;
+			break;
 		}
 
 		symbol++;
 	}
 
-	return true;
+	dlclose(main_prog);
+	return ret;
 }
 
 static struct plugin_loader *