diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:40:27 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:40:27 +0000 |
commit | 897f52083b57ea9f3ba880e95fde3c3d3a96bce3 (patch) | |
tree | b66c9b803651af624bc315244a2a7be0123e34b3 /base/nss_init.cc | |
parent | 1d9f4137eff50f1305e288767bb770151526552d (diff) | |
download | chromium_src-897f52083b57ea9f3ba880e95fde3c3d3a96bce3.zip chromium_src-897f52083b57ea9f3ba880e95fde3c3d3a96bce3.tar.gz chromium_src-897f52083b57ea9f3ba880e95fde3c3d3a96bce3.tar.bz2 |
If NSS_InitReadWrite fails, fall back on NSS_NoDB_Init.
Don't call PR_GetErrorText because it is deprecated. Just
print the error code returned by PR_GetError.
Pass NULL to NSS_NoDB_Init. (The argument is ignored.)
R=ukai
BUG=20787,20819
TEST=Chromium should work on Red Hat Enterprise Linux and CentOS that
have libnss3.so version 3.12.4.1 but libsoftokn3.so 3.11.4, which does
not support the sql: database format we're using.
Review URL: http://codereview.chromium.org/201036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/nss_init.cc')
-rw-r--r-- | base/nss_init.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/base/nss_init.cc b/base/nss_init.cc index 7fed04c..6e6ab94 100644 --- a/base/nss_init.cc +++ b/base/nss_init.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2008-2009 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. @@ -77,25 +77,26 @@ class NSSInitSingleton { NSSInitSingleton() { base::EnsureNSPRInit(); - SECStatus status; + SECStatus status = SECFailure; std::string database_dir = GetDefaultConfigDirectory(); if (!database_dir.empty()) { // Initialize with a persistant database (~/.pki/nssdb). // Use "sql:" which can be shared by multiple processes safely. status = NSS_InitReadWrite( StringPrintf("sql:%s", database_dir.c_str()).c_str()); - } else { - LOG(WARNING) << "Initialize NSS without using a persistent database " - << "(~/.pki/nssdb)."; - status = NSS_NoDB_Init("."); + if (status != SECSuccess) { + LOG(ERROR) << "Error initializing NSS with a persistent " + "databases: NSS error code " << PR_GetError(); + } } if (status != SECSuccess) { - char buffer[513] = "Couldn't retrieve error"; - PRInt32 err_length = PR_GetErrorTextLength(); - if (err_length > 0 && static_cast<size_t>(err_length) < sizeof(buffer)) - PR_GetErrorText(buffer); - - NOTREACHED() << "Error initializing NSS: " << buffer; + LOG(WARNING) << "Initialize NSS without a persistent database " + "(~/.pki/nssdb)."; + status = NSS_NoDB_Init(NULL); + if (status != SECSuccess) { + LOG(ERROR) << "Error initializing NSS without a persistent " + "database: NSS error code " << PR_GetError(); + } } // If we haven't initialized the password for the NSS databases, |