Chromium Code Reviews| Index: nss/mozilla/security/nss/lib/nss/nssinit.c |
| =================================================================== |
| --- nss/mozilla/security/nss/lib/nss/nssinit.c (revision 162724) |
| +++ nss/mozilla/security/nss/lib/nss/nssinit.c (working copy) |
| @@ -4,7 +4,7 @@ |
| * This Source Code Form is subject to the terms of the Mozilla Public |
| * License, v. 2.0. If a copy of the MPL was not distributed with this |
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| -/* $Id: nssinit.c,v 1.118 2012/09/21 21:58:44 wtc%google.com Exp $ */ |
| +/* $Id: nssinit.c,v 1.119 2012/10/09 18:22:46 emaldona%redhat.com Exp $ */ |
| #include <ctype.h> |
| #include <string.h> |
| @@ -640,15 +640,19 @@ |
| passwordRequired = pk11_password_required; |
| } |
| - /* we always try to initialize the modules */ |
| - rv = nss_InitModules(configdir, certPrefix, keyPrefix, secmodName, |
| + /* Skip the module init if we are already initted and we are trying |
| + * to init with not noCertDB and noModDB */ |
|
wtc
2012/10/18 21:20:42
I believe "not" should be removed from this commen
Ryan Sleevi
2012/10/18 21:28:51
I think you're right
|
| + if (!(isReallyInitted && noCertDB && noModDB)) { |
| + /* we always try to initialize the modules */ |
|
wtc
2012/10/18 21:20:42
This comment should be removed because nss_InitMod
Ryan Sleevi
2012/10/18 21:28:51
I agree
|
| + rv = nss_InitModules(configdir, certPrefix, keyPrefix, secmodName, |
| updateDir, updCertPrefix, updKeyPrefix, updateID, |
| updateName, configName, configStrings, passwordRequired, |
| readOnly, noCertDB, noModDB, forceOpen, optimizeSpace, |
| (initContextPtr != NULL)); |
| - if (rv != SECSuccess) { |
| - goto loser; |
| + if (rv != SECSuccess) { |
| + goto loser; |
| + } |
| } |
| @@ -923,6 +927,12 @@ |
| { |
| int i; |
| + /* make sure our lock and condition variable are initialized one and only |
| + * one time */ |
| + if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) { |
| + return SECFailure; |
| + } |
| + |
| PZ_Lock(nssInitLock); |
| if (!NSS_IsInitialized()) { |
| PZ_Unlock(nssInitLock); |
| @@ -981,6 +991,11 @@ |
| { |
| int i; |
| + /* make sure our lock and condition variable are initialized one and only |
| + * one time */ |
| + if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) { |
| + return SECFailure; |
| + } |
| PZ_Lock(nssInitLock); |
| if (!NSS_IsInitialized()) { |
| PZ_Unlock(nssInitLock); |
| @@ -1121,6 +1136,11 @@ |
| NSS_Shutdown(void) |
| { |
| SECStatus rv; |
| + /* make sure our lock and condition variable are initialized one and only |
| + * one time */ |
| + if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) { |
| + return SECFailure; |
| + } |
| PZ_Lock(nssInitLock); |
| if (!nssIsInitted) { |
| @@ -1173,6 +1193,11 @@ |
| { |
| SECStatus rv = SECSuccess; |
| + /* make sure our lock and condition variable are initialized one and only |
| + * one time */ |
| + if (PR_CallOnce(&nssInitOnce, nss_doLockInit) != PR_SUCCESS) { |
| + return SECFailure; |
| + } |
| PZ_Lock(nssInitLock); |
| /* If one or more threads are in the middle of init, wait for them |
| * to complete */ |