mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgparsemail: Die on parse error, printing errno thing.
* tools/gpgparsemail.c (parse_message): Revert the change. * tools/rfc822parse.c (transition_to_body): Set ERRNO. (transition_to_header, insert_header): Likewise. -- In the comment of rfc822parse_* functions, it explicitly explained setting ERRNO on error. For parser errors, it may not have appropriate ERRNO, in such a case, use ENOENT. Fixes-commit: c13e459ffeffb8c5387c44b3c04bb92b7111a75b Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
72fe8d652f
commit
1e9d61fb95
@ -654,7 +654,7 @@ parse_message (FILE *fp)
|
|||||||
|
|
||||||
|
|
||||||
if (rfc822parse_insert (msg, line, length))
|
if (rfc822parse_insert (msg, line, length))
|
||||||
die ("parser failed");
|
die ("parser failed: %s", strerror (errno));
|
||||||
|
|
||||||
if (info.hashing)
|
if (info.hashing)
|
||||||
{
|
{
|
||||||
|
@ -421,7 +421,10 @@ transition_to_body (rfc822parse_t msg)
|
|||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
if (msg->current_part->boundary)
|
if (msg->current_part->boundary)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
msg->current_part->boundary = malloc (strlen (s) + 1);
|
msg->current_part->boundary = malloc (strlen (s) + 1);
|
||||||
if (msg->current_part->boundary)
|
if (msg->current_part->boundary)
|
||||||
@ -440,7 +443,10 @@ transition_to_body (rfc822parse_t msg)
|
|||||||
}
|
}
|
||||||
rc = do_callback (msg, RFC822PARSE_LEVEL_DOWN);
|
rc = do_callback (msg, RFC822PARSE_LEVEL_DOWN);
|
||||||
if (msg->current_part->down)
|
if (msg->current_part->down)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
msg->current_part->down = part;
|
msg->current_part->down = part;
|
||||||
msg->current_part = part;
|
msg->current_part = part;
|
||||||
msg->in_preamble = 1;
|
msg->in_preamble = 1;
|
||||||
@ -463,7 +469,10 @@ transition_to_header (rfc822parse_t msg)
|
|||||||
|
|
||||||
if (!(msg->current_part
|
if (!(msg->current_part
|
||||||
&& !msg->current_part->right))
|
&& !msg->current_part->right))
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
part = new_part ();
|
part = new_part ();
|
||||||
if (!part)
|
if (!part)
|
||||||
@ -481,7 +490,10 @@ insert_header (rfc822parse_t msg, const unsigned char *line, size_t length)
|
|||||||
HDR_LINE hdr;
|
HDR_LINE hdr;
|
||||||
|
|
||||||
if (!msg->current_part)
|
if (!msg->current_part)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!length)
|
if (!length)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user