[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.13-137-gb8fe1b6

Lennart Poettering gitmailer-noreply at 0pointer.de
Tue Dec 16 10:11:59 PST 2008


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  e4aa5f2115d7322e691474ccd1835a2f443c27b8 (commit)

- Log -----------------------------------------------------------------
b8fe1b6... fix implementation of bind now ltdl loader for libtool 2.2
-----------------------------------------------------------------------

Summary of changes:
 src/daemon/ltdl-bind-now.c |   57 ++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 26 deletions(-)

-----------------------------------------------------------------------

commit b8fe1b683e9d373bb3475b30099593f00eaf4cff
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Dec 16 19:11:16 2008 +0100

    fix implementation of bind now ltdl loader for libtool 2.2

diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c
index 2d80fc7..8444cfb 100644
--- a/src/daemon/ltdl-bind-now.c
+++ b/src/daemon/ltdl-bind-now.c
@@ -1,7 +1,7 @@
 /***
   This file is part of PulseAudio.
 
-  Copyright 2004-2006 Lennart Poettering
+  Copyright 2004-2008 Lennart Poettering
   Copyright 2006 Pierre Ossman <ossman at cendio.se> for Cendio AB
 
   PulseAudio is free software; you can redistribute it and/or modify
@@ -39,8 +39,6 @@
 #include <pulse/i18n.h>
 
 #include <pulsecore/macro.h>
-#include <pulsecore/mutex.h>
-#include <pulsecore/thread.h>
 #include <pulsecore/log.h>
 
 #include "ltdl-bind-now.h"
@@ -67,16 +65,13 @@
   to set $LT_BIND_NOW before starting the pulsaudio binary.
 */
 
-static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise)
-{
+static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) {
     lt_module m;
 
     pa_assert(fname);
 
     if (!(m = dlopen(fname, PA_BIND_NOW))) {
-#ifdef HAVE_LT_DLMUTEX_REGISTER
-        libtool_set_error(dlerror());
-#endif
+        lt_dlseterror(LT_ERROR_CANNOT_OPEN);
         return NULL;
     }
 
@@ -88,9 +83,7 @@ static int bind_now_close(lt_user_data d, lt_module m) {
     pa_assert(m);
 
     if (dlclose(m) != 0){
-#ifdef HAVE_LT_DLMUTEX_REGISTER
-        libtool_set_error(dlerror());
-#endif
+        lt_dlseterror(LT_ERROR_CANNOT_CLOSE);
         return 1;
     }
 
@@ -104,49 +97,61 @@ static lt_ptr bind_now_find_sym(lt_user_data d, lt_module m, const char *symbol)
     pa_assert(symbol);
 
     if (!(ptr = dlsym(m, symbol))) {
-#ifdef HAVE_LT_DLMUTEX_REGISTER
-        libtool_set_error(dlerror());
-#endif
+        lt_dlseterror(LT_ERROR_SYMBOL_NOT_FOUND);
         return NULL;
     }
 
     return ptr;
 }
 
+static lt_dlvtable *bindnow_loader = NULL;
 #endif
 
 void pa_ltdl_init(void) {
 
 #ifdef PA_BIND_NOW
-    static const lt_dlvtable *dlopen_loader;
-    static lt_dlvtable bindnow_loader;
+    const lt_dlvtable *dlopen_loader;
 #endif
 
     pa_assert_se(lt_dlinit() == 0);
 
 #ifdef PA_BIND_NOW
     /* Already initialised */
-    if (dlopen_loader)
+    if (bindnow_loader)
+        return;
+
+    if (!(dlopen_loader = lt_dlloader_find((char*) "lt_dlopen"))) {
+        pa_log_warn(_("Failed to find original lt_dlopen loader."));
         return;
+    }
 
-    if (!(dlopen_loader = lt_dlloader_find("dlopen"))) {
-        pa_log_warn(_("Failed to find original dlopen loader."));
+    if (!(bindnow_loader = malloc(sizeof(lt_dlvtable)))) {
+        pa_log_error(_("Failed to allocate new dl loader."));
         return;
     }
 
-    memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader));
-    bindnow_loader.name = "bind-now-loader";
-    bindnow_loader.module_open = bind_now_open;
-    bindnow_loader.module_close = bind_now_close;
-    bindnow_loader.find_sym = bind_now_find_sym;
-    bindnow_loader.priority = LT_DLLOADER_PREPEND;
+    memcpy(bindnow_loader, dlopen_loader, sizeof(*bindnow_loader));
+    bindnow_loader->name = "bind-now-loader";
+    bindnow_loader->module_open = bind_now_open;
+    bindnow_loader->module_close = bind_now_close;
+    bindnow_loader->find_sym = bind_now_find_sym;
+    bindnow_loader->priority = LT_DLLOADER_PREPEND;
 
     /* Add our BIND_NOW loader as the default module loader. */
-    if (lt_dlloader_add(&bindnow_loader) != 0)
+    if (lt_dlloader_add(bindnow_loader) != 0) {
         pa_log_warn(_("Failed to add bind-now-loader."));
+        free(bindnow_loader);
+        bindnow_loader = NULL;
+    }
 #endif
 }
 
 void pa_ltdl_done(void) {
     pa_assert_se(lt_dlexit() == 0);
+
+#ifdef PA_BIND_NOW
+    /* lt_dlexit() will free our loader vtable, hence reset our
+     * pointer to it here */
+    bindnow_loader = NULL;
+#endif
 }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list