From 3cb835685f1f1834cadeca2842c8fd43c96e2ff2 Mon Sep 17 00:00:00 2001 From: "roeber%netscape.com" Date: Tue, 16 May 2000 01:55:20 +0000 Subject: [PATCH] sync the database after writes --- security/nss/lib/ckfw/dbm/db.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/security/nss/lib/ckfw/dbm/db.c b/security/nss/lib/ckfw/dbm/db.c index 8f7bc91d72c9..3b47390b6d85 100644 --- a/security/nss/lib/ckfw/dbm/db.c +++ b/security/nss/lib/ckfw/dbm/db.c @@ -32,7 +32,7 @@ */ #ifdef DEBUG -static const char CVS_ID[] = "@(#) $RCSfile: db.c,v $ $Revision: 1.2 $ $Date: 2000/05/15 20:59:11 $ $Name: $"; +static const char CVS_ID[] = "@(#) $RCSfile: db.c,v $ $Revision: 1.3 $ $Date: 2000/05/16 01:55:20 $ $Name: $"; #endif /* DEBUG */ #include "ckdbm.h" @@ -139,6 +139,7 @@ nss_dbm_db_get_format_version v.data = buffer; v.size = nssUTF8_Size((NSSUTF8 *)v.data, (PRStatus *)NULL); dbrv = db->db->put(db->db, &k, &v, 0); + (void)db->db->sync(db->db, 0); rv = nss_dbm_db_format_version; } else { /* No error return.. */ @@ -178,6 +179,11 @@ nss_dbm_db_set_label rv = CKR_DEVICE_ERROR; } + dbrv = db->db->sync(db->db, 0); + if( 0 != dbrv ) { + rv = CKR_DEVICE_ERROR; + } + (void)NSSCKFWMutex_Unlock(db->crustylock); } @@ -248,6 +254,12 @@ nss_dbm_db_delete_object goto done; } + dbrv = dbt->my_db->db->sync(dbt->my_db->db, 0); + if( 0 != dbrv ) { + rv = CKR_DEVICE_ERROR; + goto done; + } + done: (void)NSSCKFWMutex_Unlock(dbt->my_db->crustylock); } @@ -304,6 +316,11 @@ nss_dbm_db_new_handle goto done; } + rv = db->db->sync(db->db, 0); + if( 0 != rv ) { + goto done; + } + done: (void)NSSCKFWMutex_Unlock(db->crustylock); } @@ -587,6 +604,8 @@ nss_dbm_db_create_object *pError = CKR_DEVICE_ERROR; } + (void)db->db->sync(db->db, 0); + (void)NSSCKFWMutex_Unlock(db->crustylock); } @@ -1031,6 +1050,8 @@ nss_dbm_db_set_object_attribute goto done; } + (void)dbt->my_db->db->sync(dbt->my_db->db, 0); + done: (void)NSSCKFWMutex_Unlock(dbt->my_db->crustylock); }