diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-20 18:09:33 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-20 18:09:33 +0800 |
commit | 8aac813144a26bd5a9e6f89c9e470fff36404183 (patch) | |
tree | 2ab22a00f9e208e8a1163e80db63a2258c041fdb | |
parent | 87936d2c014265f645c0463585270f11b7326d5c (diff) | |
download | pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar.gz pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar.bz2 pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar.lz pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar.xz pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.tar.zst pttbbs-8aac813144a26bd5a9e6f89c9e470fff36404183.zip |
fix race of assession
note that SHM_t was modified
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2341 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/pttstruct.h | 11 | ||||
-rw-r--r-- | mbbsd/assess.c | 14 |
2 files changed, 15 insertions, 10 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 6689e851..a0c8e140 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -316,7 +316,6 @@ typedef struct userinfo_t { char from[27]; /* machine name the user called in from */ int from_alias; char birth; /* 是否是生日 Ptt*/ - char tty[11]; /* tty port */ short nFriends; /* 下面 friend[] 只用到前幾個, 用來 bsearch */ int friend[MAX_FRIEND]; @@ -324,7 +323,6 @@ typedef struct userinfo_t { /* 好友比較的cache 前兩個bit是狀態 */ int reject[MAX_REJECT]; unsigned short int chess_elo_rating; - char pad[2]; int lock; int friendtotal; /* 好友比較的cache 大小 */ char msgcount; @@ -335,12 +333,19 @@ typedef struct userinfo_t { unsigned char lockmode; /* 不准 multi_login 玩的東西 */ char turn; /* for gomo */ char mateid[IDLEN + 1]; /* for gomo */ + + /* 為了 sync 回 .PASSWDS 時使用 */ unsigned short int five_win; unsigned short int five_lose; unsigned short int five_tie; unsigned short int chc_win; unsigned short int chc_lose; unsigned short int chc_tie; + unsigned short int goodpost; + unsigned short int badpost; + unsigned short int goodsale; + unsigned short int badsale; + char mailalert; char sex; char color; @@ -469,7 +474,7 @@ typedef struct { } e; } GV2; - /* fromcache */ + /* 故鄉 fromcache */ unsigned int home_ip[MAX_FROM]; unsigned int home_mask[MAX_FROM]; char home_desc[MAX_FROM][32]; diff --git a/mbbsd/assess.c b/mbbsd/assess.c index 489054d4..ae5c43a2 100644 --- a/mbbsd/assess.c +++ b/mbbsd/assess.c @@ -14,16 +14,16 @@ inline static void inc(unsigned char *num, int n) (*num) += n; } -/* FIXME race occurs when he's online. - * passwd_update in mbbsd.c:u_exit() override the later value. */ -#define modify_column(name) \ -int inc_##name(char *userid, int num) \ +#define modify_column(_attr) \ +int inc_##_attr(char *userid, int num) \ { \ int uid = getuser(userid);\ if(uid>0 ){ \ - inc(&xuser.name, num); \ - passwd_update(uid, &xuser); \ - return xuser.name; }\ + userinfo_t *uinfo = search_ulistn(uid); \ + inc(&uinfo->_attr, num); \ + inc(&xuser._attr, num); \ + passwd_update(uid, &xuser); \ + return xuser._attr; }\ return 0;\ } |