Commit b75ebf83 authored by Thomas Roessler's avatar Thomas Roessler

Catch some error conditions.

parent d871a52f
...@@ -86,8 +86,20 @@ void mutt_edit_headers (const char *editor, ...@@ -86,8 +86,20 @@ void mutt_edit_headers (const char *editor,
mutt_free_list (&msg->env->userhdrs); mutt_free_list (&msg->env->userhdrs);
/* Read the temp file back in */ /* Read the temp file back in */
ifp = fopen (path, "r"); if ((ifp = fopen (path, "r")) == NULL)
ofp = safe_fopen (body, "w"); {
mutt_perror (path);
return;
}
if ((ofp = safe_fopen (body, "w")) == NULL)
{
/* intentionally leak a possible temporary file here */
fclose (ifp);
mutt_perror (body);
return;
}
n = mutt_read_rfc822_header (ifp, NULL, 1, 0); n = mutt_read_rfc822_header (ifp, NULL, 1, 0);
while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0) while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0)
fwrite (buffer, 1, i, ofp); fwrite (buffer, 1, i, ofp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment