diff options
author | Werner Koch <wk@gnupg.org> | 2015-06-04 17:34:33 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2015-06-04 17:34:55 +0200 |
commit | bf06d04f53296f4b4b73b9360cf1571559bb2295 (patch) | |
tree | 1cf683828bb43715bc1b9896886a4ceb14a62bdd /g10/tdbdump.c | |
parent | gpg: Re-indent and improve documentation of g10/tdbio.c (diff) | |
download | gnupg2-bf06d04f53296f4b4b73b9360cf1571559bb2295.tar.xz gnupg2-bf06d04f53296f4b4b73b9360cf1571559bb2295.zip |
gpg: Fix output in case of a corrupted trustdb.
* g10/tdbdump.c (list_trustdb): Add arg FP and change callers to pass
es_stdout.
* g10/tdbio.c (upd_hashtable): On a corrupted trustdb call
list_trustdb only in verbose > 1 mode and let it dump to stderr.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/tdbdump.c')
-rw-r--r-- | g10/tdbdump.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/g10/tdbdump.c b/g10/tdbdump.c index f9a047351..ff90b46ed 100644 --- a/g10/tdbdump.c +++ b/g10/tdbdump.c @@ -61,11 +61,11 @@ write_record( TRUSTREC *rec ) } -/**************** - * Dump the entire trustdb or only the entries of one key. +/* + * Dump the entire trustdb to FP or only the entries of one key. */ void -list_trustdb (const char *username) +list_trustdb (estream_t fp, const char *username) { TRUSTREC rec; @@ -78,12 +78,12 @@ list_trustdb (const char *username) ulong recnum; int i; - es_printf ("TrustDB: %s\n", tdbio_get_dbname() ); - for(i=9+strlen(tdbio_get_dbname()); i > 0; i-- ) - es_putc ('-', es_stdout); - es_putc ('\n', es_stdout); - for(recnum=0; !tdbio_read_record( recnum, &rec, 0); recnum++ ) - tdbio_dump_record (&rec, es_stdout); + es_fprintf (fp, "TrustDB: %s\n", tdbio_get_dbname ()); + for (i = 9 + strlen (tdbio_get_dbname()); i > 0; i-- ) + es_fputc ('-', fp); + es_putc ('\n', fp); + for (recnum=0; !tdbio_read_record (recnum, &rec, 0); recnum++) + tdbio_dump_record (&rec, fp); } } |