X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=nntp%2Fnewsrc.c;h=bb477f53067adf3805bff1e4d5ca558f8f009deb;hb=9ed7a487e3a922f2cbb222961c2c9710c3a65f91;hp=3b8e1fa292f03c042535d77e285a6424cc648131;hpb=49081299c673ceebc38d9a4f0985608cb3aecfce;p=apps%2Fmadmutt.git diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 3b8e1fa..bb477f5 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -9,29 +9,16 @@ * please see the file GPL in the top level source directory. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include -#include -#include -#include -#include #include -#include - -#include -#include -#include -#include #include - #include +#include #include "mutt.h" #include "sort.h" -#include "mx.h" #include "nntp.h" void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d) @@ -142,7 +129,7 @@ static int slurp_newsrc (NNTP_SERVER * news) return -1; /* hmm, should we use dotlock? */ if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1)) { - fclose (fp); + m_fclose(&fp); return -1; } @@ -152,7 +139,7 @@ static int slurp_newsrc (NNTP_SERVER * news) p_delete(&buf); mx_unlock_file (news->newsrc, fileno (fp), 0); - fclose (fp); + m_fclose(&fp); return 0; } @@ -248,7 +235,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) mutt_newsgroup_stat (data); } } - fclose (idx); + m_fclose(&idx); return 0; } @@ -632,13 +619,13 @@ static int mutt_update_list_file (char *filename, char *section, /* if file not exist, create it */ if ((ifp = safe_fopen (filename, "a"))) - fclose (ifp); + m_fclose(&ifp); if (!(ifp = safe_fopen (filename, "r"))) { mutt_error (_("Unable to open %s for reading"), filename); return -1; } if (mx_lock_file (filename, fileno (ifp), 0, 0, 1)) { - fclose (ifp); + m_fclose(&ifp); mutt_error (_("Unable to lock %s"), filename); return -1; } @@ -651,7 +638,7 @@ static int mutt_update_list_file (char *filename, char *section, m_strcpy(tmpfile, sizeof(tmpfile), basename(filename)); mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile)); if (!(ofp = fopen (tmpfile, "w"))) { - fclose (ifp); + m_fclose(&ifp); mutt_error (_("Unable to open %s for writing"), tmpfile); return -1; } @@ -713,8 +700,8 @@ static int mutt_update_list_file (char *filename, char *section, r = fputc ('\n', ofp); } mx_unlock_file (filename, fileno (ifp), 0); - fclose (ofp); - fclose (ifp); + m_fclose(&ofp); + m_fclose(&ifp); if (r == EOF) { unlink (tmpfile); mutt_error (_("Can't write %s"), tmpfile); @@ -861,13 +848,13 @@ int nntp_save_cache_index (NNTP_SERVER * news) snprintf (buf, sizeof (buf), "%s %d %d %c\n", d->group, d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n'); if (fputs (buf, f) == EOF) { - fclose (f); + m_fclose(&f); unlink (file); return -1; } } } - fclose (f); + m_fclose(&f); if (nntp_update_cacheindex (news, NULL)) { unlink (file); @@ -934,7 +921,7 @@ int nntp_save_cache_group (CONTEXT * ctx) snprintf (buf, sizeof (buf), "\t%zd\t%d\tXref: %s\n", h->content->length, h->lines, NONULL (h->env->xref)); if (fputs (buf, f) == EOF) { - fclose (f); + m_fclose(&f); unlink (file); return -1; } @@ -946,7 +933,7 @@ int nntp_save_cache_group (CONTEXT * ctx) Sort = save; mutt_sort_headers (ctx, 0); } - fclose (f); + m_fclose(&f); if (nntp_update_cacheindex (((NNTP_DATA *) ctx->data)->nserv, (NNTP_DATA *) ctx->data)) {