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
@@ -312,6 +312,20 @@ run_recovery (GDBM_FILE dbf, GDBM_FILE new_dbf, gdbm_recovery *rcvr, int flags)
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"),
@@ -325,6 +339,7 @@ run_recovery (GDBM_FILE dbf, GDBM_FILE new_dbf, gdbm_recovery *rcvr, int flags)
}
}
}
+ }
return 0;
}
@@ -356,6 +371,7 @@ gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags)
rcvr->recovered_buckets = 0;
rcvr->failed_keys = 0;
rcvr->failed_buckets = 0;
+ rcvr->duplicate_keys = 0;
rcvr->backup_name = NULL;
rc = 0;

Return to:

Send suggestions and report system problems to the System administrator.