X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=handler.c;h=59c70de211a1fce93d6f1be6f0d613e70f681e9e;hp=e49d973a21380bc68681a1fdc65728939fd421bd;hb=8f83c2fd6b6096772e90e45d6034a054c673eac2;hpb=124aee0f600ef550fd1c73e8d7a60556f4f6afd0 diff --git a/handler.c b/handler.c index e49d973..59c70de 100644 --- a/handler.c +++ b/handler.c @@ -1083,7 +1083,7 @@ static int autoview_handler (BODY * a, STATE * s) mutt_copy_bytes (s->fpin, fpin, a->length); if (!piped) { - safe_fclose (&fpin); + m_fclose(&fpin); thepid = mutt_create_filter (command, NULL, &fpout, &fperr); } else { @@ -1140,12 +1140,12 @@ static int autoview_handler (BODY * a, STATE * s) } bail: - safe_fclose (&fpout); - safe_fclose (&fperr); + m_fclose(&fpout); + m_fclose(&fperr); mutt_wait_filter (thepid); if (piped) - safe_fclose (&fpin); + m_fclose(&fpin); else mutt_unlink (tempfile); @@ -1388,10 +1388,9 @@ int mutt_body_handler (BODY * b, STATE * s) if (!plaintext) { /* decode to a tempfile, saving the original destination */ fp = s->fpout; - mutt_mktemp (tempfile); - if ((s->fpout = safe_fopen (tempfile, "w")) == NULL) { + s->fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL); + if (!s->fpout) { mutt_error _("Unable to open temporary file!"); - goto bail; } /* decoding the attachment changes the size and offset, so save a copy @@ -1407,16 +1406,16 @@ int mutt_body_handler (BODY * b, STATE * s) s->prefix = NULL; decode = 1; - } - else + } else { b->type = TYPETEXT; + } mutt_decode_attachment (b, s); if (decode) { b->length = ftello (s->fpout); b->offset = 0; - fclose (s->fpout); + m_fclose(&s->fpout); /* restore final destination and substitute the tempfile for input */ s->fpout = fp; @@ -1440,7 +1439,7 @@ int mutt_body_handler (BODY * b, STATE * s) b->offset = tmpoffset; /* restore the original source stream */ - fclose (s->fpin); + m_fclose(&s->fpin); s->fpin = fp; } }