char tmp[1024];
int c;
int rv = -1;
+ int source_file_is_unchanged = 1;
size_t lf, lpu, lpo;
char *t;
{
mutt_decoder_pop (dec, tmp, sizeof (tmp), &lpo);
if (lpo)
- fwrite (tmp, lpo, 1, tmpfp);
+ {
+ if (fwrite (tmp, lpo, 1, tmpfp) == EOF)
+ goto bail;
+ }
}
while (lpo);
}
}
+ if (lf == EOF && !feof(fp))
+ {
+ goto bail;
+ }
mutt_decoder_push (dec, NULL, 0, NULL);
do
{
mutt_decoder_pop (dec, tmp, sizeof (tmp), &lpo);
- if (lpo) fwrite (tmp, lpo, 1, tmpfp);
+ if (lpo)
+ {
+ if (fwrite (tmp, lpo, 1, tmpfp) == EOF)
+ goto bail;
+ }
}
while (lpo);
fclose (fp); fp = NULL;
rewind (tmpfp);
+
+ source_file_is_unchanged = 0;
+
/* don't use safe_fopen here - we're just going
* to overwrite the old file.
*/
-
if ((fp = fopen (fname, "w")) == NULL)
goto bail;
bail:
if (rv == -1)
- mutt_error (_("Error while recoding %s. See %s for recovering your data."),
- fname, tempfile);
+ {
+ if (source_file_is_unchanged)
+ {
+ mutt_error (_("Error while recoding %s. "
+ "Leave it unchanged."),
+ fname);
+ }
+ else
+ {
+ mutt_error (_("Error while recoding %s. "
+ "See %s for recovering your data."),
+ fname, tempfile);
+ }
+ }
if (fp) fclose (fp);
if (tmpfp) fclose (tmpfp);