summaryrefslogtreecommitdiffabout
path: root/src/recover.c
Side-by-side diff
Diffstat (limited to 'src/recover.c') (more/less context) (show whitespace changes)
-rw-r--r--src/recover.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/recover.c b/src/recover.c
index d6d4ff9..721c23f 100644
--- a/src/recover.c
+++ b/src/recover.c
@@ -309,12 +309,26 @@ run_recovery (GDBM_FILE dbf, GDBM_FILE new_dbf, gdbm_recovery *rcvr, int flags)
data.dptr = dptr + key.dsize;
data.dsize = dbf->bucket->h_table[i].data_size;
if (gdbm_store (new_dbf, key, data, GDBM_INSERT) != 0)
{
+ switch (gdbm_last_errno (new_dbf))
+ {
+ case GDBM_CANNOT_REPLACE:
+ rcvr->duplicate_keys++;
+ if (flags & GDBM_RCVR_ERRFUN)
+ rcvr->errfun (rcvr->data,
+ _("ignoring duplicate key %d:%d (%lu:%d)"),
+ bucket_dir, i,
+ (unsigned long) dbf->bucket->h_table[i].data_pointer,
+ dbf->bucket->h_table[i].key_size
+ + dbf->bucket->h_table[i].data_size);
+ break;
+
+ default:
if (flags & GDBM_RCVR_ERRFUN)
rcvr->errfun (rcvr->data,
_("fatal: can't store element %d:%d (%lu:%d): %s"),
bucket_dir, i,
(unsigned long) dbf->bucket->h_table[i].data_pointer,
dbf->bucket->h_table[i].key_size
@@ -322,12 +336,13 @@ run_recovery (GDBM_FILE dbf, GDBM_FILE new_dbf, gdbm_recovery *rcvr, int flags)
gdbm_db_strerror (new_dbf));
return -1;
}
}
}
}
+ }
return 0;
}
int
gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags)
@@ -353,12 +368,13 @@ gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags)
flags = 0;
}
rcvr->recovered_keys = 0;
rcvr->recovered_buckets = 0;
rcvr->failed_keys = 0;
rcvr->failed_buckets = 0;
+ rcvr->duplicate_keys = 0;
rcvr->backup_name = NULL;
rc = 0;
if ((flags & GDBM_RCVR_FORCE) || check_db (dbf))
{
len = strlen (dbf->name);

Return to:

Send suggestions and report system problems to the System administrator.