[education/rkward] rkward/rbackend: Add more error handling
Thomas Friedrichsmeier
null at kde.org
Fri Aug 2 14:16:22 BST 2024
Git commit e76a1f56f684748c04b28e5ff9f6aed935bec8d1 by Thomas Friedrichsmeier.
Committed on 02/08/2024 at 13:16.
Pushed by tfry into branch 'master'.
Add more error handling
M +8 -2 rkward/rbackend/rkrbackend_dlopen.cpp
https://invent.kde.org/education/rkward/-/commit/e76a1f56f684748c04b28e5ff9f6aed935bec8d1
diff --git a/rkward/rbackend/rkrbackend_dlopen.cpp b/rkward/rbackend/rkrbackend_dlopen.cpp
index c487b85ef..4dac871df 100644
--- a/rkward/rbackend/rkrbackend_dlopen.cpp
+++ b/rkward/rbackend/rkrbackend_dlopen.cpp
@@ -61,9 +61,15 @@ auto loadlib(const char* name) {
#if !(defined(Win32) || defined(__APPLE__))
auto loadGlib(unsigned int *version) {
+ *version = 0;
auto glib = dlopen("libglib-2.0.so", RTLD_LAZY | RTLD_LOCAL);
- auto glib_verp = static_cast<unsigned int *>(resolve_symb(glib, "glib_minor_version"));
- *version = glib_verp ? (*glib_verp) : 0;
+ if (glib) {
+ dlerror();
+ auto glib_verp = static_cast<unsigned int *>(resolve_symb(glib, "glib_minor_version")); // Major version is always "2"
+ if (glib_verp && !dlerror()) {
+ *version = *glib_verp;
+ }
+ }
return glib;
}
More information about the rkward-tracker
mailing list