Even after ceph::crypto::shutdown, the library looked
already initialized; this broke the ForkDeathTest.MD5
in "make check", and NSS-using daemons.
See
921d4b3d8b79485a6786f8ca75b2a96ea377da84 for more.
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
#elif USE_NSS
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static bool crypto_init = false;
+
void ceph::crypto::init() {
- static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
- static bool crypto_init = false;
pthread_mutex_lock(&lock);
if (crypto_init) {
pthread_mutex_unlock(&lock);
}
void ceph::crypto::shutdown() {
+ pthread_mutex_lock(&lock);
+ assert(crypto_init);
+ crypto_init = false;
+ pthread_mutex_unlock(&lock);
SECStatus s;
s = NSS_Shutdown();
assert(s == SECSuccess);