1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-03 12:11:33 +01:00

gpg: Change another BUG() call to a regular error message.

* g10/mainproc.c (proc_tree): Replace BUG by a proper error messages.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2014-11-28 12:20:42 +01:00
parent 7aee3579be
commit e59b1cc747

View File

@ -2123,8 +2123,9 @@ proc_tree (CTX c, kbnode_t node)
free_md_filter_context (&c->mfx); free_md_filter_context (&c->mfx);
/* Prepare to create all requested message digests. */ /* Prepare to create all requested message digests. */
if (gcry_md_open (&c->mfx.md, 0, 0)) rc = gcry_md_open (&c->mfx.md, 0, 0);
BUG (); if (rc)
goto hash_err;
/* Fixme: why looking for the signature packet and not the /* Fixme: why looking for the signature packet and not the
one-pass packet? */ one-pass packet? */
@ -2154,6 +2155,7 @@ proc_tree (CTX c, kbnode_t node)
use_textmode); use_textmode);
} }
hash_err:
if (rc) if (rc)
{ {
log_error ("can't hash datafile: %s\n", g10_errstr (rc)); log_error ("can't hash datafile: %s\n", g10_errstr (rc));
@ -2225,8 +2227,9 @@ proc_tree (CTX c, kbnode_t node)
{ {
/* Detached signature */ /* Detached signature */
free_md_filter_context (&c->mfx); free_md_filter_context (&c->mfx);
if (gcry_md_open (&c->mfx.md, sig->digest_algo, 0)) rc = gcry_md_open (&c->mfx.md, sig->digest_algo, 0);
BUG (); if (rc)
goto detached_hash_err;
if (RFC2440 || RFC4880) if (RFC2440 || RFC4880)
; /* Strict RFC mode. */ ; /* Strict RFC mode. */
@ -2236,8 +2239,9 @@ proc_tree (CTX c, kbnode_t node)
{ {
/* Enable a workaround for a pgp5 bug when the detached /* Enable a workaround for a pgp5 bug when the detached
* signature has been created in textmode. */ * signature has been created in textmode. */
if (gcry_md_open (&c->mfx.md2, sig->digest_algo, 0 )) rc = gcry_md_open (&c->mfx.md2, sig->digest_algo, 0);
BUG (); if (rc)
goto detached_hash_err;
} }
/* Here we used to have another hack to work around a pgp /* Here we used to have another hack to work around a pgp
@ -2276,6 +2280,7 @@ proc_tree (CTX c, kbnode_t node)
(sig->sig_class == 0x01)); (sig->sig_class == 0x01));
} }
detached_hash_err:
if (rc) if (rc)
{ {
log_error ("can't hash datafile: %s\n", g10_errstr(rc)); log_error ("can't hash datafile: %s\n", g10_errstr(rc));