summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:02:55 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:02:55 +0800
commita955ee6b77652aa57f0009f9878aa88d1755ce8d (patch)
tree65f3829af4bc758226b85e00eb8ea80a06a8f799
parent60b3015900838f0afbf3377fc3a75351be510cbe (diff)
downloadpttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar.gz
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar.bz2
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar.lz
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar.xz
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.tar.zst
pttbbs-a955ee6b77652aa57f0009f9878aa88d1755ce8d.zip
localtime() may destory its return buffer after second call
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2652 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index e8447a1f..9d8bdc1e 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -906,18 +906,18 @@ inline static void foreign_warning(void){
static void
user_login(void)
{
- struct tm *ptime;
+ struct tm ptime;
int nowusers, ifbirth = 0, i;
/* get local time */
- ptime = localtime4(&now);
+ ptime = *localtime4(&now);
/* 初始化: random number 增加user跟時間的差異 */
mysrand();
/* show welcome_login */
- if( (ifbirth = (ptime->tm_mday == cuser.day &&
- ptime->tm_mon + 1 == cuser.month)) ){
+ if( (ifbirth = (ptime.tm_mday == cuser.day &&
+ ptime.tm_mon + 1 == cuser.month)) ){
more("etc/Welcome_birth", NA);
}
else {
@@ -982,9 +982,9 @@ user_login(void)
welcome_msg();
if( ifbirth ){
- birthday_make_a_wish(ptime, localtime4(&(cuser.lastlogin)));
+ birthday_make_a_wish(&ptime, localtime4(&(cuser.lastlogin)));
if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' )
- currutmp->birth = 1;
+ currutmp->birth = 1;
}
check_bad_login();
check_mailbox_quota();