From 7007588c72ec22498b1bca5a0502af7ddc0ea35f Mon Sep 17 00:00:00 2001 From: kcwu Date: Sat, 27 Jul 2002 13:50:57 +0000 Subject: 1.only sysop can edit database directly 2.fix crash because of missing database git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@448 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/indict.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/indict.c b/mbbsd/indict.c index fe7da8c4..14650fea 100644 --- a/mbbsd/indict.c +++ b/mbbsd/indict.c @@ -1,4 +1,4 @@ -/* $Id: indict.c,v 1.9 2002/07/27 10:04:59 kcwu Exp $ */ +/* $Id: indict.c,v 1.10 2002/07/27 13:50:57 kcwu Exp $ */ #include "bbs.h" #define REFER "etc/dicts" @@ -128,7 +128,7 @@ use_dict() more("etc/dict.hlp", YEA); clear(); continue; - } else if (word[0] == 'e') { + } else if (word[0] == 'e' && HAS_PERM(PERM_SYSOP)) { vedit(database, NA, NULL); clear(); continue; @@ -137,9 +137,9 @@ use_dict() continue; } } + i = 0; if ((fp = fopen(database, "r"))) { - i = 0; - while (fgets(lang, 150, fp) != NULL) { + while (fgets(lang, sizeof(lang), fp) != NULL) { if (lang[65] == '[') { lang[65] = 0; f = 1; @@ -166,8 +166,8 @@ use_dict() } } } + fclose(fp); } - fclose(fp); if (i == 0) { getdata(5, 0, "沒這個資料耶,新增嗎?(y/N)", lang, 3, LCECHO); if (lang[0] == 'y') { -- cgit v1.2.3