From 6a049ab7d7709f5ff8c326915c79faa1106324c8 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 26 Mar 2007 02:47:21 +0000 Subject: not necessary to dereference mark race git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3495 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'mbbsd/mbbsd.c') diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 257c925a..eadcc622 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1066,23 +1066,23 @@ inline static void foreign_warning(void){ static void user_login(void) { - struct tm ptime, lasttime; + struct tm *ptime, *lasttime; int nowusers, ifbirth = 0, i; /* NOTE! 在 setup_utmp 之前, 不應該有任何 blocking/slow function, * 否則可藉機 race condition 達到 multi-login */ /* get local time */ - ptime = *localtime4(&now); + ptime = localtime4(&now); /* 初始化: random number 增加user跟時間的差異 */ mysrand(); /* check if over18 */ - if( (ptime.tm_year - cuser.year) >= 18 || - (ptime.tm_year - cuser.year == 17 && - ((ptime.tm_mon+1) > cuser.month || - ((ptime.tm_mon+1) == cuser.month && ptime.tm_mday > cuser.day))) ) + if( (ptime->tm_year - cuser.year) >= 18 || + (ptime->tm_year - cuser.year == 17 && + ((ptime->tm_mon+1) > cuser.month || + ((ptime->tm_mon+1) == cuser.month && ptime->tm_mday > cuser.day))) ) over18 = 1; log_usies("ENTER", fromhost); @@ -1109,11 +1109,11 @@ user_login(void) /* 初始化 uinfo、flag、mode */ setup_utmp(LOGIN); enter_uflag = cuser.uflag; - lasttime = *localtime4(&cuser.lastlogin); + lasttime = localtime4(&cuser.lastlogin); /* 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 { @@ -1156,7 +1156,7 @@ user_login(void) welcome_msg(); if( ifbirth ){ - birthday_make_a_wish(&ptime, &lasttime); + birthday_make_a_wish(ptime, lasttime); if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' ) currutmp->birth = 1; } @@ -1179,7 +1179,7 @@ user_login(void) check_mailbox_quota(); } - if(ptime.tm_yday!=lasttime.tm_yday) + if(ptime->tm_yday != lasttime->tm_yday) STATINC(STAT_TODAYLOGIN_MAX); if (!PERM_HIDE(currutmp)) { @@ -1200,7 +1200,7 @@ user_login(void) #endif /* login time update */ - if(ptime.tm_yday!=lasttime.tm_yday) + if(ptime->tm_yday != lasttime->tm_yday) STATINC(STAT_TODAYLOGIN_MIN); -- cgit v1.2.3