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
This commit is contained in:
parent
c590a7f322
commit
9dd2ab720e
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user