File bsc#1075418-libqb-log-callsite-symbols-main-object.patch of Package libqb.26134
Index: libqb-1.0.1.22-59ea/lib/log.c
===================================================================
--- libqb-1.0.1.22-59ea.orig/lib/log.c 2017-02-15 17:32:45.000000000 +0100
+++ libqb-1.0.1.22-59ea/lib/log.c 2018-04-20 15:43:02.000000000 +0200
@@ -781,44 +781,50 @@ _log_so_walk_callback(struct dl_phdr_inf
}
static void
+_log_register_one(const char *dlname)
+{
+ void *handle, *start, *stop;
+ const char *error;
+
+ handle = dlopen(dlname, RTLD_LAZY);
+ error = dlerror();
+ if (!handle || error) {
+ qb_log(LOG_ERR, "%s", error);
+ goto done;
+ }
+
+ start = dlsym(handle, QB_ATTR_SECTION_START_STR);
+ error = dlerror();
+ if (error) {
+ goto done;
+ }
+
+ stop = dlsym(handle, QB_ATTR_SECTION_STOP_STR);
+ error = dlerror();
+ if (error) {
+ goto done;
+
+ } else {
+ qb_log_callsites_register(start, stop);
+ }
+done:
+ if (handle)
+ dlclose(handle);
+}
+
+static void
_log_so_walk_dlnames(void)
{
struct dlname *dlname;
struct qb_list_head *iter;
struct qb_list_head *next;
- void *handle;
- void *start;
- void *stop;
- const char *error;
-
+ _log_register_one(NULL);
qb_list_for_each_safe(iter, next, &dlnames) {
dlname = qb_list_entry(iter, struct dlname, list);
- handle = dlopen(dlname->dln_name, RTLD_LAZY);
- error = dlerror();
- if (!handle || error) {
- qb_log(LOG_ERR, "%s", error);
- goto done;
- }
-
- start = dlsym(handle, QB_ATTR_SECTION_START_STR);
- error = dlerror();
- if (error) {
- goto done;
- }
-
- stop = dlsym(handle, QB_ATTR_SECTION_STOP_STR);
- error = dlerror();
- if (error) {
- goto done;
-
- } else {
- qb_log_callsites_register(start, stop);
- }
-done:
- if (handle)
- dlclose(handle);
+ _log_register_one(dlname->dln_name);
+
qb_list_del(iter);
if (dlname->dln_name)
free(dlname->dln_name);