Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: printing/backend/print_backend_cups.cc

Issue 9290036: Linux: Try several different paths to the GnuTls library when trying to dynamically load and call g… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add error messages Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/print_backend_cups.cc
===================================================================
--- printing/backend/print_backend_cups.cc (revision 119116)
+++ printing/backend/print_backend_cups.cc (working copy)
@@ -59,23 +59,31 @@
private:
void Init() {
+ const char* kGnuTlsFiles[] = {
+ "libgnutls.so.28",
+ "libgnutls.so.26",
+ "libgnutls.so",
+ };
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
- const char* kGnuTlsFile = "libgnutls.so";
- void* gnutls_lib = dlopen(kGnuTlsFile, RTLD_NOW);
- if (!gnutls_lib) {
- LOG(ERROR) << "Cannot load " << kGnuTlsFile;
+ for (size_t i = 0; i < arraysize(kGnuTlsFiles); ++i) {
+ void* gnutls_lib = dlopen(kGnuTlsFiles[i], RTLD_NOW);
+ if (!gnutls_lib) {
+ VLOG(1) << "Cannot load " << kGnuTlsFiles[i];
+ continue;
+ }
+ const char* kGnuTlsInitFuncName = "gnutls_global_init";
+ int (*pgnutls_global_init)(void) = reinterpret_cast<int(*)()>(
+ dlsym(gnutls_lib, kGnuTlsInitFuncName));
+ if (!pgnutls_global_init) {
+ VLOG(1) << "Could not find " << kGnuTlsInitFuncName
+ << " in " << kGnuTlsFiles[i];
+ continue;
+ }
+ if ((*pgnutls_global_init)() != 0)
+ LOG(ERROR) << "gnutls_global_init() failed";
return;
}
- const char* kGnuTlsInitFuncName = "gnutls_global_init";
- int (*pgnutls_global_init)(void) = reinterpret_cast<int(*)()>(
- dlsym(gnutls_lib, kGnuTlsInitFuncName));
- if (!pgnutls_global_init) {
- LOG(ERROR) << "Could not find " << kGnuTlsInitFuncName
- << " in " << kGnuTlsFile;
- return;
- }
- if ((*pgnutls_global_init)() != 0)
- LOG(ERROR) << "Gnutls initialization failed";
+ LOG(ERROR) << "Cannot find libgnutls";
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698