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

Unified Diff: base/nss_init.cc

Issue 201036: If NSS_InitReadWrite fails, fall back on NSS_NoDB_Init.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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: base/nss_init.cc
===================================================================
--- base/nss_init.cc (revision 25183)
+++ base/nss_init.cc (working copy)
@@ -59,25 +59,26 @@
class NSSInitSingleton {
public:
NSSInitSingleton() {
- 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,
« 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