summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-10-31 13:57:33 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-10-31 13:57:33 +0800
commit660026e0c5dfba57e564f8e884c67c68da90a9ed (patch)
tree577a43e9622192b3a930a659b1ac2eed35c9e113
parent4722b6345107b12c6208736777d1cffb6021842d (diff)
downloadpttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar.gz
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar.bz2
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar.lz
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar.xz
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.tar.zst
pttbbs-660026e0c5dfba57e564f8e884c67c68da90a9ed.zip
workaround account bug
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5189 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/util/account.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/pttbbs/util/account.c b/pttbbs/util/account.c
index 201709d0..a0a0bc2a 100644
--- a/pttbbs/util/account.c
+++ b/pttbbs/util/account.c
@@ -323,25 +323,25 @@ out:
static int
update_holiday(struct tm *ptime)
{
- int i = 0, cnt = 0;
- char buf[128], *p;
+ int i = 0;
+ char buf[128];
FILE *fp;
if ((fp = fopen("etc/today_is", "r")) == NULL)
return 1;
+ // I'm not sure what this is supposed to (check w/wens),
+ // but since this is buggy now, let's make it as "rotate through".
+ buf[0] = 0;
for (i = 0; i <= ptime->tm_hour; i++) {
if (!fgets(buf, sizeof(buf), fp)) {
- cnt = i;
- i = i - 1 + (ptime->tm_hour - i) / cnt * cnt;
- rewind(fp);
+ rewind(fp);
+ fgets(buf, sizeof(buf), fp);
}
}
fclose(fp);
-
- if ((p = strchr(buf, '\n')))
- *p = 0;
+ chomp(buf);
memset(SHM->today_is, 0, sizeof(SHM->today_is));
strlcpy(SHM->today_is, buf, sizeof(SHM->today_is));