FLTK logo

[master] 75dd467 - Update with changes from source (commit bcb1d791) - cont'd.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 75dd467 - Update with changes from source (commit bcb1d791) - cont'd. "ManoloFLTK" Sep 21, 2022  
 
commit 75dd467dc5f85b66c00a6e6bc8fe177395a0a074
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed Sep 21 15:11:10 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Sep 21 15:11:10 2022 +0200

    Update with changes from source (commit bcb1d791) - cont'd.

 libdecor/src/libdecor-plugin.h |  4 ++++
 libdecor/src/libdecor.c        | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git libdecor/src/libdecor-plugin.h libdecor/src/libdecor-plugin.h
index e91ee2b..ba80ce6 100644
--- libdecor/src/libdecor-plugin.h
+++ libdecor/src/libdecor-plugin.h
@@ -1,6 +1,7 @@
 /*
  * Copyright © 2017-2018 Red Hat Inc.
  * Copyright © 2018 Jonas �dahl
+ * Copyright © 2019 Christian Rauch
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -79,6 +80,9 @@ struct libdecor_plugin_description {
 
 	/* Vfunc used for constructing a plugin instance. */
 	libdecor_plugin_constructor constructor;
+
+	/* NULL terminated list of incompatible symbols. */
+	char *conflicting_symbols[1024];
 };
 
 struct libdecor_plugin_interface {
diff --git libdecor/src/libdecor.c libdecor/src/libdecor.c
index 9bd418f..7d48d14 100644
--- libdecor/src/libdecor.c
+++ libdecor/src/libdecor.c
@@ -1,6 +1,7 @@
 /*
  * Copyright © 2017-2018 Red Hat Inc.
  * Copyright © 2018 Jonas �dahl
+ * Copyright © 2019 Christian Rauch
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -1387,6 +1388,24 @@ calculate_priority(const struct libdecor_plugin_description *plugin_description)
 	return -1;
 }
 
+static bool
+check_symbol_conflicts(const struct libdecor_plugin_description *plugin_description)
+{
+	char * const *symbol;
+
+	symbol = plugin_description->conflicting_symbols;
+	while (*symbol) {
+		dlerror();
+		dlsym (RTLD_DEFAULT, *symbol);
+		if (!dlerror())
+			return false;
+
+		symbol++;
+	}
+
+	return true;
+}
+
 static struct plugin_loader *
 load_plugin_loader(struct libdecor *context,
 		   const char *path,
@@ -1438,6 +1457,11 @@ load_plugin_loader(struct libdecor *context,
 		return NULL;
 	}
 
+	if (!check_symbol_conflicts(plugin_description)) {
+		dlclose(lib);
+		return NULL;
+	}
+
 	priority = calculate_priority(plugin_description);
 	if (priority == -1) {
 		fprintf(stderr,
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.