summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontulli <devnull@localhost>1998-06-18 00:52:47 +0000
committermontulli <devnull@localhost>1998-06-18 00:52:47 +0000
commit3fb213714831f84b2e254397164a15a50ba583b6 (patch)
treea058c616a287052287ddfd5c4c540b85555571f3
parentf19d3d8267eeb00e1a0bfa24f9a7e2582b5af128 (diff)
downloadnss-hg-3fb213714831f84b2e254397164a15a50ba583b6.tar.gz
merge tip with montulli branch and create montulli1
-rw-r--r--dbm/include/hash.h1
-rw-r--r--dbm/src/hash.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/dbm/include/hash.h b/dbm/include/hash.h
index b898fe048..4db5d44f2 100644
--- a/dbm/include/hash.h
+++ b/dbm/include/hash.h
@@ -123,6 +123,7 @@ typedef struct htab { /* Memory resident data structure */
int save_file; /* Indicates whether we need to flush
* file at
* exit */
+ int dirty_bit; /* has db changed */
uint32 *mapp[NCACHED]; /* Pointers to page maps */
int nmaps; /* Initial number of bitmaps */
int nbufs; /* Number of buffers left to
diff --git a/dbm/src/hash.c b/dbm/src/hash.c
index c8e9a234f..56dd1045f 100644
--- a/dbm/src/hash.c
+++ b/dbm/src/hash.c
@@ -161,6 +161,7 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl
if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
RETURN_ERROR(ENOMEM, error0);
hashp->fp = NO_FILE;
+ hashp->dirty_bit = 0;
if(file)
hashp->filename = strdup(file);
@@ -611,7 +612,7 @@ flush_meta(HTAB *hashp)
#endif
int fp, i, wsize;
- if (!hashp->save_file)
+ if (!hashp->save_file || !hashp->dirty_bit)
return (0);
hashp->MAGIC = HASHMAGIC;
hashp->VERSION = HASHVERSION;
@@ -695,6 +696,8 @@ hash_put(
if (!hashp)
return (DBM_ERROR);
+ hashp->dirty_bit = 1;
+
if (flag && flag != R_NOOVERWRITE) {
hashp->dbmerrno = errno = EINVAL;
return (DBM_ERROR);
@@ -731,6 +734,8 @@ hash_delete(
if (!hashp)
return (DBM_ERROR);
+ hashp->dirty_bit = 1;
+
if (flag && flag != R_CURSOR) {
hashp->dbmerrno = errno = EINVAL;
return (DBM_ERROR);