summaryrefslogtreecommitdiffstats
path: root/mbbsd/admin.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-20 00:06:06 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-20 00:06:06 +0800
commit795d7da28a8514e8315643820badb86919da2e2e (patch)
tree1911b4e7e874dd5999ea49ac5767ca720c7ac2e9 /mbbsd/admin.c
parent26382c16358fd5e6746a7a4d00210248b0c255c5 (diff)
downloadpttbbs-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/admin.c')
-rw-r--r--mbbsd/admin.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 3b41802f..b1d48245 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -1,4 +1,4 @@
-/* $Id: admin.c,v 1.30 2003/01/16 11:58:04 kcwu Exp $ */
+/* $Id: admin.c,v 1.31 2003/01/19 16:06:05 kcwu Exp $ */
#include "bbs.h"
/* �ϥΪ̺޲z */
@@ -35,6 +35,7 @@ search_key_user(char *passwdfile, int mode)
FILE *fp1 = fopen(passwdfile, "r");
char buf[128], key[22], genbuf[8];
+ assert(fp1);
clear();
getdata(0, 0, mode ? "�п�J�ϥΪ�����r[�q��|�a�}|�m�W|�W���a�I|"
"email|�p��id] :" : "�п�Jid :", key, sizeof(key), DOECHO);
@@ -66,12 +67,15 @@ search_key_user(char *passwdfile, int mode)
while ((ch = igetch()) == 0);
if (ch == ' ')
break;
- if (ch == 'q' || ch == 'Q')
+ if (ch == 'q' || ch == 'Q') {
+ fclose(fp1);
return 0;
+ }
if (ch == 's' && !mode) {
if ((ch = searchuser(user.userid))) {
setumoney(ch, user.money);
passwd_update(ch, &user);
+ fclose(fp1);
return 0;
} else {
move(b_lines - 1, 0);
@@ -98,6 +102,7 @@ search_key_user(char *passwdfile, int mode)
fprintf(stderr, "�L�k�إ߱b��\n");
exit(1);
}
+ fclose(fp1);
return 0;
}
}
@@ -1080,8 +1085,10 @@ give_money()
prints("�s���]�U���e");
pressanykey();
- if (vedit("etc/givemoney.why", NA, NULL) < 0)
+ if (vedit("etc/givemoney.why", NA, NULL) < 0) {
+ fclose(fp2);
return 1;
+ }
stand_title("�o����...");
if (to_all) {