X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sendlib.c;h=2bad9a69db6026e844578bf17034d1baa38ac5d9;hp=c406c38c94d976b3f659489a423ee4159f1ed674;hb=6ebff74ad242d4c56fb7762965b19cee14fd2daa;hpb=86c5af6b888685ff4337090e37ba72ad040df965 diff --git a/sendlib.c b/sendlib.c index c406c38..2bad9a6 100644 --- a/sendlib.c +++ b/sendlib.c @@ -395,7 +395,7 @@ int mutt_write_mime_body (BODY * a, FILE * f) #undef write_as_text_part fgetconv_close (&fc); - fclose (fpin); + m_fclose(&fpin); return (ferror (f) ? -1 : 0); } @@ -776,7 +776,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b) } b->file_charset = fromcode; p_delete(&tocode); - safe_fclose (&fp); + m_fclose(&fp); return info; } } @@ -786,7 +786,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b) update_content_info (info, &state, buffer, r); update_content_info (info, &state, 0, 0); - safe_fclose (&fp); + m_fclose(&fp); if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset)) parameter_setval(&b->parameter, "charset", @@ -885,7 +885,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path) p = NULL; } } - fclose (f); + m_fclose(&f); } } @@ -918,14 +918,14 @@ void mutt_message_to_7bit (BODY * a, FILE * fp) a->offset = 0; if (stat (a->filename, &sb) == -1) { mutt_perror ("stat"); - fclose (fpin); + m_fclose(&fpin); } a->length = sb.st_size; } - mutt_mktemp (temp); - if (!(fpout = safe_fopen (temp, "w+"))) { - mutt_perror ("fopen"); + fpout = m_tempfile(temp, sizeof(temp), NONULL(Tempdir), NULL); + if (!fpout) { + mutt_error(_("Could not create temporary file")); goto cleanup; } @@ -946,9 +946,9 @@ cleanup: p_delete(&line); if (fpin && !fp) - fclose (fpin); + m_fclose(&fpin); if (fpout) - fclose (fpout); + m_fclose(&fpout); else return; @@ -988,14 +988,14 @@ static void transform_to_7bit (BODY * a, FILE * fpin) a->noconv = 1; a->force_charset = 1; - mutt_mktemp (buff); - if ((s.fpout = safe_fopen (buff, "w")) == NULL) { - mutt_perror ("fopen"); + s.fpout = m_tempfile(buff, sizeof(buff), NONULL(Tempdir), NULL); + if (!s.fpout) { + mutt_error(_("Could not create temporary file")); return; } s.fpin = fpin; mutt_decode_attachment (a, &s); - fclose (s.fpout); + m_fclose(&s.fpout); a->d_filename = a->filename; a->filename = m_strdup(buff); a->unlink = 1; @@ -1167,7 +1167,7 @@ BODY *mutt_make_message_attach (CONTEXT * ctx, HEADER * hdr, int attach_msg) mutt_update_encoding (body); body->parts = body->hdr->content; - fclose (fp); + m_fclose(&fp); return (body); } @@ -2068,8 +2068,8 @@ static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to, if (!fp) fp = msg->fp; - mutt_mktemp (tempfile); - if ((f = safe_fopen (tempfile, "w")) != NULL) { + f = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL); + if (f) { int ch_flags = CH_XMIT | CH_NONEWLINE | CH_NOQFROM; if (!option (OPTBOUNCEDELIVERED)) @@ -2085,10 +2085,10 @@ static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to, mutt_copy_header (fp, h, f, ch_flags, NULL); fputc ('\n', f); mutt_copy_bytes (fp, f, h->content->length); - fclose (f); + m_fclose(&f); - ret = mutt_invoke_mta (env_from, to, NULL, NULL, tempfile, - h->content->encoding == ENC8BIT); + ret = mutt_invoke_mta(env_from, to, NULL, NULL, tempfile, + h->content->encoding == ENC8BIT); } if (msg) @@ -2160,11 +2160,11 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, * the message body begins with "From " */ if (f.magic == M_MMDF || f.magic == M_MBOX) { - mutt_mktemp (tempfile); - if ((tempfp = safe_fopen (tempfile, "w+")) == NULL) { - mutt_perror (tempfile); + tempfp = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL); + if (!tempfp) { + mutt_error(_("Could not create temporary file")); mx_close_mailbox (&f, NULL); - return (-1); + return -1; } } @@ -2265,7 +2265,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, fflush (tempfp); if (ferror (tempfp)) { - fclose (tempfp); + m_fclose(&tempfp); unlink (tempfile); mx_commit_message (msg, &f); /* XXX - really? */ mx_close_message (&msg); @@ -2283,7 +2283,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, /* copy the body and clean up */ rewind (tempfp); r = mutt_copy_stream (tempfp, msg->fp); - if (fclose (tempfp) != 0) + if (m_fclose(&tempfp) != 0) r = -1; /* if there was an error, leave the temp version */ if (!r)