summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-06-02 02:02:49 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-06-02 02:02:49 +0800
commit1308747b04da9fea7387f1e602eb3aa56712e91c (patch)
tree12365acc6ec1794a8304eb7f6a09ee48a06880bd /mbbsd/talk.c
parente9e709d0352f58f5855f4e7f37204a443926c767 (diff)
downloadpttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar.gz
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar.bz2
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar.lz
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar.xz
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.tar.zst
pttbbs-1308747b04da9fea7387f1e602eb3aa56712e91c.zip
* fix racing bug for giving money.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3527 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index a4ba7a1d..9e998621 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2853,8 +2853,11 @@ userlist(void)
if (HasUserPerm(PERM_LOGINOK) &&
strcmp(uentp->userid, cuser.userid) != 0) {
char genbuf[10];
+ char userid[IDLEN + 1];
+ int touid=uentp->uid;
+ strlcpy(userid, uentp->userid, sizeof(userid));
move(b_lines - 2, 0);
- prints("要給 %s 多少錢呢? ", uentp->userid);
+ prints("要給 %s 多少錢呢? ", userid);
if (getdata(b_lines - 1, 0, "[銀行轉帳]: ",
genbuf, 7, LCECHO)) {
clrtoeol();
@@ -2863,11 +2866,11 @@ userlist(void)
break;
}
if (getans("確定要給 %s %d Ptt 幣嗎? [N/y]",
- uentp->userid, ch) != 'y'){
+ userid, ch) != 'y'){
redrawall = redraw = 1;
break;
}
- if (do_give_money(uentp->userid, uentp->uid, ch) < 0)
+ if (do_give_money(userid, touid, ch) < 0)
vmsgf("交易失敗,還剩下 %d 錢", SHM->money[usernum - 1]);
else
vmsgf("交易成功\,還剩下 %d 錢", SHM->money[usernum - 1]);