aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authormattdr.breakpad@gmail.com <mattdr.breakpad@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-01-29 20:34:07 +0000
committermattdr.breakpad@gmail.com <mattdr.breakpad@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-01-29 20:34:07 +0000
commit9dd2ab720e4c95e987732df35b164b465a74cf19 (patch)
tree1fbd08eea6500b54de3084daf88a827876962b89 /src/common/linux
parentWindows: Fix 64-bit compitation of crash_generation_app. (diff)
downloadbreakpad-9dd2ab720e4c95e987732df35b164b465a74cf19.tar.xz
Support statically-linked libcurl for HTTP uploads in Linux
https://breakpad.appspot.com/1064002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1277 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/http_upload.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
index fead76e9..d49f2276 100644
--- a/src/common/linux/http_upload.cc
+++ b/src/common/linux/http_upload.cc
@@ -70,7 +70,17 @@ bool HTTPUpload::SendRequest(const string &url,
if (!CheckParameters(parameters))
return false;
- void *curl_lib = dlopen("libcurl.so", RTLD_NOW);
+ // We may have been linked statically; if curl_easy_init is in the
+ // current binary, no need to search for a dynamic version.
+ void* curl_lib = dlopen(NULL, RTLD_NOW);
+ if (!curl_lib || dlsym(curl_lib, "curl_easy_init") == NULL) {
+ dlerror(); // Clear dlerror before attempting to open libraries.
+ dlclose(curl_lib);
+ curl_lib = NULL;
+ }
+ if (!curl_lib) {
+ curl_lib = dlopen("libcurl.so", RTLD_NOW);
+ }
if (!curl_lib) {
if (error_description != NULL)
*error_description = dlerror();