Blame SOURCES/nss-3.67-fix-sdb-timeout.patch

90c79f
diff --git a/lib/softoken/sdb.c b/lib/softoken/sdb.c
90c79f
--- a/lib/softoken/sdb.c
90c79f
+++ b/lib/softoken/sdb.c
90c79f
@@ -1519,16 +1519,18 @@ sdb_Begin(SDB *sdb)
90c79f
 
90c79f
     sqlerr = sqlite3_prepare_v2(sqlDB, BEGIN_CMD, -1, &stmt, NULL);
90c79f
 
90c79f
     do {
90c79f
         sqlerr = sqlite3_step(stmt);
90c79f
         if (sqlerr == SQLITE_BUSY) {
90c79f
             PR_Sleep(SDB_BUSY_RETRY_TIME);
90c79f
         }
90c79f
+        /* don't retry BEGIN transaction*/
90c79f
+        retry = 0;
90c79f
     } while (!sdb_done(sqlerr, &retry));
90c79f
 
90c79f
     if (stmt) {
90c79f
         sqlite3_reset(stmt);
90c79f
         sqlite3_finalize(stmt);
90c79f
     }
90c79f
 
90c79f
 loser:
90c79f
diff --git a/lib/softoken/sftkdb.c b/lib/softoken/sftkdb.c
90c79f
--- a/lib/softoken/sftkdb.c
90c79f
+++ b/lib/softoken/sftkdb.c
90c79f
@@ -1521,17 +1521,17 @@ sftkdb_DestroyObject(SFTKDBHandle *handl
90c79f
     if (handle == NULL) {
90c79f
         return CKR_TOKEN_WRITE_PROTECTED;
90c79f
     }
90c79f
     db = SFTK_GET_SDB(handle);
90c79f
     objectID &= SFTK_OBJ_ID_MASK;
90c79f
 
90c79f
     crv = (*db->sdb_Begin)(db);
90c79f
     if (crv != CKR_OK) {
90c79f
-        goto loser;
90c79f
+        return crv;
90c79f
     }
90c79f
     crv = (*db->sdb_DestroyObject)(db, objectID);
90c79f
     if (crv != CKR_OK) {
90c79f
         goto loser;
90c79f
     }
90c79f
     /* if the database supports meta data, delete any old signatures
90c79f
      * that we may have added */
90c79f
     if ((db->sdb_flags & SDB_HAS_META) == SDB_HAS_META) {
90c79f
@@ -2456,17 +2456,17 @@ sftkdb_Update(SFTKDBHandle *handle, SECI
90c79f
         return CKR_OK;
90c79f
     }
90c79f
     /*
90c79f
      * put the whole update under a transaction. This allows us to handle
90c79f
      * any possible race conditions between with the updateID check.
90c79f
      */
90c79f
     crv = (*handle->db->sdb_Begin)(handle->db);
90c79f
     if (crv != CKR_OK) {
90c79f
-        goto loser;
90c79f
+        return crv;
90c79f
     }
90c79f
     inTransaction = PR_TRUE;
90c79f
 
90c79f
     /* some one else has already updated this db */
90c79f
     if (sftkdb_hasUpdate(sftkdb_TypeString(handle),
90c79f
                          handle->db, handle->updateID)) {
90c79f
         crv = CKR_OK;
90c79f
         goto done;