[pulseaudio] 01/02: Fix crash when main cannot be found in patch util-Try-finding-out-application-name-using-dladdr Closes: #758556, 758531

Felipe Sateler fsateler at moszumanska.debian.org
Sat Aug 30 00:42:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

fsateler pushed a commit to annotated tag debian/5.0-11
in repository pulseaudio.

commit 9439f312ad8ecade01547f339896c07a33059360
Author: Felipe Sateler <fsateler at debian.org>
Date:   Tue Aug 26 00:27:29 2014 -0400

    Fix crash when main cannot be found in patch util-Try-finding-out-application-name-using-dladdr Closes: #758556, 758531
---
 debian/changelog                                   |  8 +++
 ...finding-out-application-name-using-dladdr.patch | 57 ++++++++++++++--------
 2 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 713e58c..d8d409e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+pulseaudio (5.0-11) UNRELEASED; urgency=medium
+
+  * Fix crash when main cannot be found in patch
+    util-Try-finding-out-application-name-using-dladdr
+    Closes: #758556, 758531
+
+ -- Felipe Sateler <fsateler at debian.org>  Tue, 26 Aug 2014 00:22:19 -0400
+
 pulseaudio (5.0-10) experimental; urgency=medium
 
   * patch: try finding out binary name using dladdr
diff --git a/debian/patches/util-Try-finding-out-application-name-using-dladdr.patch b/debian/patches/util-Try-finding-out-application-name-using-dladdr.patch
index 36c37b6..139239d 100644
--- a/debian/patches/util-Try-finding-out-application-name-using-dladdr.patch
+++ b/debian/patches/util-Try-finding-out-application-name-using-dladdr.patch
@@ -1,13 +1,15 @@
-From 139358150c8ba7f40d9412147d6ee0824005fc4b Mon Sep 17 00:00:00 2001
-From: Felipe Sateler <fsateler at debian.org>
-Date: Thu, 14 Aug 2014 00:43:00 -0400
-Subject: [PATCH] util: Try finding out application name using dladdr if
- available
+commit 704c96985be104396b86f6b2c0a96827b9d90501
+Author: Felipe Sateler <fsateler at debian.org>
+Date:   Thu Aug 14 00:43:00 2014 -0400
 
----
- configure.ac     |  2 ++
- src/pulse/util.c | 18 ++++++++++++++++++
- 2 files changed, 20 insertions(+)
+    util: Try finding out application name using dladdr if available
+    
+    This fixes getting the binary name in the Hurd, or any other port using
+    the GNU C library, but only in the case where the library is directly
+    linked to. Opening with dlopen will not work.
+    
+    Change since last version: use a weak reference to main, so that we
+    don't crash when main cannot be found.
 
 --- a/configure.ac
 +++ b/configure.ac
@@ -22,7 +24,18 @@ Subject: [PATCH] util: Try finding out application name using dladdr if
  #      External libraries         #
 --- a/src/pulse/util.c
 +++ b/src/pulse/util.c
-@@ -32,6 +32,7 @@
+@@ -24,6 +24,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
+ #include <errno.h>
+ #include <limits.h>
+ #include <stdio.h>
+@@ -32,6 +36,7 @@
  #include <time.h>
  #include <unistd.h>
  #include <sys/types.h>
@@ -30,30 +43,32 @@ Subject: [PATCH] util: Try finding out application name using dladdr if
  
  #ifdef HAVE_PWD_H
  #include <pwd.h>
-@@ -64,6 +65,10 @@
+@@ -64,6 +69,10 @@
  
  #include "util.h"
  
-+#ifdef HAVE_DLADDR
-+extern int main(int, char*[]);
++#if defined(HAVE_DLADDR) && defined(PA_GCC_WEAKREF)
++static int _main() PA_GCC_WEAKREF(main);
 +#endif
 +
  char *pa_get_user_name(char *s, size_t l) {
      const char *p;
      char *name = NULL;
-@@ -205,6 +210,19 @@ char *pa_get_binary_name(char *s, size_t
+@@ -205,6 +214,21 @@ char *pa_get_binary_name(char *s, size_t
          }
      }
  #endif
 +
-+#ifdef HAVE_DLADDR
++#if defined(HAVE_DLADDR) && defined(PA_GCC_WEAKREF)
 +    {
-+        Dl_info DLInfo;
-+        int err = dladdr(&main, &DLInfo);
-+        if (err != 0) {
-+            char *p = pa_realpath(DLInfo.dli_fname);
-+            if (p) {
-+                return p;
++        Dl_info info;
++        if(_main) {
++            int err = dladdr(&_main, &info);
++            if (err != 0) {
++                char *p = pa_realpath(info.dli_fname);
++                if (p) {
++                    return p;
++                }
 +            }
 +        }
 +    }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-pulseaudio/pulseaudio.git



More information about the pkg-pulseaudio-devel mailing list