int ret;
HEADER *h = ctx->hdrs[ctx->msgcount];
- mutt_mktemp (tempfile);
- if (!(f = safe_fopen (tempfile, "w+")))
+ f = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (!f)
return -1;
if (!msgid)
ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
if (ret) {
- fclose (f);
+ m_fclose(&f);
unlink (tempfile);
return (ret == -1 ? -1 : 1);
}
h->article_num = article_num;
h->env = mutt_read_rfc822_header (f, h, 0, 0);
- fclose (f);
+ m_fclose(&f);
unlink (tempfile);
if (h->env->xref != NULL)
mutt_message ("%s %d/%d", msg2, c, r);
add_xover_line (buf, &fc);
}
- fclose (f);
+ m_fclose(&f);
nntp_data->lastLoaded = fc.last;
first = fc.last + 1;
if (ctx->msgcount > oldmsgcount)
p_delete(&cache->path);
cache->index = ctx->hdrs[msgno]->index;
- mutt_mktemp (path);
- cache->path = m_strdup(path);
- if (!(msg->fp = safe_fopen (path, "w+"))) {
- p_delete(&cache->path);
+ msg->fp = m_tempfile(path, sizeof(path), NONULL(Tempdir), NULL);
+ if (!msg->fp) {
return -1;
}
+ cache->path = m_strdup(path);
if (ctx->hdrs[msgno]->article_num == 0)
snprintf (buf, sizeof (buf), "ARTICLE %s\r\n",
}
if (ret) {
- fclose (msg->fp);
+ m_fclose(&msg->fp);
unlink (path);
p_delete(&cache->path);
return -1;
else
mutt_socket_write(nntp_data->nserv->conn, buf + 1);
}
- fclose (f);
+ m_fclose(&f);
if (buf[m_strlen(buf) - 1] != '\n')
mutt_socket_write(nntp_data->nserv->conn, "\r\n");
i++;
}
add_group (NULL, NULL);
- fclose (f);
+ m_fclose(&f);
mutt_clear_error ();
return 0;
}