diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-20 00:06:06 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-20 00:06:06 +0800 |
commit | 795d7da28a8514e8315643820badb86919da2e2e (patch) | |
tree | 1911b4e7e874dd5999ea49ac5767ca720c7ac2e9 /mbbsd/mail.c | |
parent | 26382c16358fd5e6746a7a4d00210248b0c255c5 (diff) | |
download | pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar.gz pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar.bz2 pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar.lz pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar.xz pttbbs-795d7da28a8514e8315643820badb86919da2e2e.tar.zst pttbbs-795d7da28a8514e8315643820badb86919da2e2e.zip |
* there are so many fopen() without fclose()
* assert fopen()
* clean up
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@638 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r-- | mbbsd/mail.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 7f145867..3d06e087 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1,4 +1,4 @@ -/* $Id: mail.c,v 1.24 2003/01/16 14:47:43 kcwu Exp $ */ +/* $Id: mail.c,v 1.25 2003/01/19 16:06:06 kcwu Exp $ */ #include "bbs.h" char currmaildir[32]; static char msg_cc[] = "\033[32m[群組名單]\033[m\n"; @@ -434,6 +434,7 @@ multi_send(char *title) AddNameList(quote_user); reciper = 1; fp = fopen(quote_file, "r"); + assert(fp); while (fgets(genbuf, 256, fp)) { if (strncmp(genbuf, "※ ", 3)) { if (listing) @@ -452,6 +453,7 @@ multi_send(char *title) listing = 1; } } + fclose(fp); ShowNameList(3, 0, msg_cc); } multi_list(&reciper); @@ -995,7 +997,7 @@ mail_reply(int ent, fileheader_t * fhdr, char *direct) if (strchr(quote_user, '.')) { genbuf[0] = '\0'; if ((fp = fopen(quote_file, "r"))) { - fgets(genbuf, 512, fp); + fgets(genbuf, sizeof(genbuf), fp); fclose(fp); } t = strtok(genbuf, str_space); @@ -1167,6 +1169,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) setuserfile(fname, fhdr->filename); if (ent) { xptr = fopen(xfpath, "w"); + assert(xptr); strlcpy(save_title, xfile.title, sizeof(save_title)); strlcpy(xfpath, currboard, sizeof(xfpath)); @@ -1349,6 +1352,7 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) snprintf(fname, sizeof(fname), BBSHOME "/jobspool/water.des.%s-%d", cuser.userid, (int)now); fp = fopen(fname, "wt"); + assert(fp); fprintf(fp, "%s\n%s\n%d\n", cuser.userid, address, cmode); fclose(fp); vmsg("設定完成, 系統將在下一個整點(尖鋒時段除外)將資料寄給您"); @@ -1458,7 +1462,7 @@ bbs_sendmail(char *fpath, char *title, char *receiver) fin = fopen(fpath, "r"); } fout = popen(genbuf, "w"); - if (fin == NULL || fout == NULL) + if (fin == NULL || fout == NULL) // XXX no fclose() if only one fopen succeed return -1; if (fpath) |