summaryrefslogtreecommitdiffstats
path: root/mbbsd/chc.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-10 17:13:24 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-10 17:13:24 +0800
commit20e520708906a428f8aad674e9197d4d0ed5ce65 (patch)
tree900e3e070bef12191f0ce0452947081e07a04a89 /mbbsd/chc.c
parenta3fa704d1272a56465922cad9d52eb5cabc8ac05 (diff)
downloadpttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar.gz
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar.bz2
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar.lz
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar.xz
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.tar.zst
pttbbs-20e520708906a428f8aad674e9197d4d0ed5ce65.zip
code audit
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1175 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chc.c')
-rw-r--r--mbbsd/chc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index fbd716a1..f63ae972 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -318,12 +318,13 @@ chc_log_poem(void)
struct dirent **namelist;
int n;
+ // TODO use readdir(), don't use lots of memory
n = scandir(BBSHOME"/etc/chess", &namelist, chc_filter, alphasort);
if (n < 0)
perror("scandir");
else {
char buf[80];
- FILE *fp;
+ FILE *fp; // XXX shadow global fp
sprintf(buf, BBSHOME"/etc/chess/%s", namelist[rand() % n]->d_name);
if ((fp = fopen(buf, "r")) == NULL)
return -1;