diff options
author | Nelson Billing <nbilling@google.com> | 2020-02-21 15:54:49 -0800 |
---|---|---|
committer | Nelson Billing <nbilling@google.com> | 2020-02-22 00:03:09 +0000 |
commit | 815497495eee92e028320ef96dc5b7ec13d85216 (patch) | |
tree | fe2ea81b30d4e754ba2e27be539f388ac67407bb /src/common | |
parent | linux: fix symupload build failures (diff) | |
download | breakpad-815497495eee92e028320ef96dc5b7ec13d85216.tar.xz |
Make LibcurlWrapper support static linking.
- Didn't used to support statically linked libcurl, now it does (like
HttpUpload does).
Change-Id: Ic014548225b129f0c1c9ffe6a671f5bd2352b6e6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2068947
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/linux/libcurl_wrapper.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc index d935174b..e96c2038 100644 --- a/src/common/linux/libcurl_wrapper.cc +++ b/src/common/linux/libcurl_wrapper.cc @@ -173,7 +173,19 @@ bool LibcurlWrapper::SendSimplePostRequest(const string& url, } bool LibcurlWrapper::Init() { - curl_lib_ = dlopen("libcurl.so", RTLD_NOW); + // First check to see if libcurl was statically linked: + curl_lib_ = dlopen(nullptr, RTLD_NOW); + if (curl_lib_ && + (!dlsym(curl_lib_, "curl_easy_init") || + !dlsym(curl_lib_, "curl_easy_setopt"))) { + // Not statically linked, try again below. + dlerror(); // Clear dlerror before attempting to open libraries. + dlclose(curl_lib_); + curl_lib_ = nullptr; + } + if (!curl_lib_) { + curl_lib_ = dlopen("libcurl.so", RTLD_NOW); + } if (!curl_lib_) { curl_lib_ = dlopen("libcurl.so.4", RTLD_NOW); } |