kbx: Include deleted records into the --stats output.

* kbx/keybox-dump.c (_keybox_dump_file): Take deleted records in
account.
--

This also changes the numbering of the records to reflect the real
record number.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 5ef0d7a795)
This commit is contained in:
Werner Koch 2019-08-23 15:44:05 +02:00
parent e854580fa5
commit 34f55c5e34
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 6 additions and 1 deletions

View File

@ -573,6 +573,7 @@ _keybox_dump_file (const char *filename, int stats_only, FILE *outfp)
int rc;
unsigned long count = 0;
struct file_stats_s stats;
int skipped_deleted;
memset (&stats, 0, sizeof stats);
@ -581,7 +582,7 @@ _keybox_dump_file (const char *filename, int stats_only, FILE *outfp)
for (;;)
{
rc = _keybox_read_blob (&blob, fp, NULL);
rc = _keybox_read_blob (&blob, fp, &skipped_deleted);
if (gpg_err_code (rc) == GPG_ERR_TOO_LARGE
&& gpg_err_source (rc) == GPG_ERR_SOURCE_KEYBOX)
{
@ -598,8 +599,12 @@ _keybox_dump_file (const char *filename, int stats_only, FILE *outfp)
if (rc)
break;
count += skipped_deleted;
if (stats_only)
{
stats.total_blob_count += skipped_deleted;
stats.empty_blob_count += skipped_deleted;
update_stats (blob, &stats);
}
else