diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 20:52:56 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 20:52:56 +0000 |
commit | 203fb82c077fb154b431ddc0d90aea7c4942a5e3 (patch) | |
tree | d6b1d37c0b1febc573c45ac5122d1044c69ebc9b /printing | |
parent | a32b565688f11f6114546bff0fc80bf23342d3d1 (diff) | |
download | chromium_src-203fb82c077fb154b431ddc0d90aea7c4942a5e3.zip chromium_src-203fb82c077fb154b431ddc0d90aea7c4942a5e3.tar.gz chromium_src-203fb82c077fb154b431ddc0d90aea7c4942a5e3.tar.bz2 |
Linux: Try several different paths to the GnuTls library when trying to dynamically load and call gnutls_global_init().
BUG=96734
TEST=none
Review URL: http://codereview.chromium.org/9290036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119283 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/backend/print_backend_cups.cc | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index ad0b0c9..19275c1 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -59,23 +59,31 @@ class GcryptInitializer { 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; - 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; + 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; } - if ((*pgnutls_global_init)() != 0) - LOG(ERROR) << "Gnutls initialization failed"; + LOG(ERROR) << "Cannot find libgnutls"; } }; |