From 281254ba811744efdf2f294b8fd08c1d9c00e230 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Tue, 9 Feb 2016 14:35:03 +1300 Subject: [PATCH] bug 1245745 include libpulse version in update URL r=glandium --- xpcom/base/nsSystemInfo.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 224dfb78a39..3ffe96e9f49 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -31,6 +31,7 @@ #ifdef MOZ_WIDGET_GTK #include +#include #include #include #include "mozilla/Tokenizer.h" @@ -702,13 +703,33 @@ nsSystemInfo::Init() gtk_micro_version); } + nsAutoCString secondaryLibrary; if (gtkver_len > 0) { - rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"), - nsDependentCSubstring(gtkver, gtkver_len)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + secondaryLibrary.Append(nsDependentCSubstring(gtkver, gtkver_len)); + } + + void* libpulse = dlopen("libpulse.so.0", RTLD_LAZY); + const char* libpulseVersion = "not-available"; + if (libpulse) { + auto pa_get_library_version = reinterpret_cast + (dlsym(libpulse, "pa_get_library_version")); + + if (pa_get_library_version) { + libpulseVersion = pa_get_library_version(); } } + + secondaryLibrary.AppendPrintf(",libpulse %s", libpulseVersion); + + if (libpulse) { + dlclose(libpulse); + } + + rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"), + secondaryLibrary); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } #endif #ifdef MOZ_WIDGET_ANDROID