summaryrefslogtreecommitdiffstats
path: root/mbbsd/user.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-06-19 01:14:32 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-06-19 01:14:32 +0800
commitf5649a5aed5a9fc3b31b7964087252525fca5e60 (patch)
treeb9ed59307e2eda718c057f1aa0ce016619b44f1d /mbbsd/user.c
parent2edb2692f086fee13c46311bfcdab4eae847447c (diff)
downloadpttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.gz
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.bz2
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.lz
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.xz
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.zst
pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.zip
* use strtok_r() instead of strtok(). fix bad strtok() usages.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3545 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r--mbbsd/user.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c
index b9b15e3f..4abc44ca 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -847,15 +847,16 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if (getdata_str(i++, 0, "五子棋戰績 勝/敗/和:", buf, 16, DOECHO,
genbuf))
while (1) {
- p = strtok(buf, "/\r\n");
+ char *strtok_pos;
+ p = strtok_r(buf, "/\r\n", &strtok_pos);
if (!p)
break;
x.five_win = atoi(p);
- p = strtok(NULL, "/\r\n");
+ p = strtok_r(NULL, "/\r\n", &strtok_pos);
if (!p)
break;
x.five_lose = atoi(p);
- p = strtok(NULL, "/\r\n");
+ p = strtok_r(NULL, "/\r\n", &strtok_pos);
if (!p)
break;
x.five_tie = atoi(p);
@@ -866,15 +867,16 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if (getdata_str(i++, 0, "象棋戰績 勝/敗/和:", buf, 16, DOECHO,
genbuf))
while (1) {
- p = strtok(buf, "/\r\n");
+ char *strtok_pos;
+ p = strtok_r(buf, "/\r\n", &strtok_pos);
if (!p)
break;
x.chc_win = atoi(p);
- p = strtok(NULL, "/\r\n");
+ p = strtok_r(NULL, "/\r\n", &strtok_pos);
if (!p)
break;
x.chc_lose = atoi(p);
- p = strtok(NULL, "/\r\n");
+ p = strtok_r(NULL, "/\r\n", &strtok_pos);
if (!p)
break;
x.chc_tie = atoi(p);
@@ -1037,12 +1039,13 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if (mail_changed) {
char justify_tmp[REGLEN + 1];
char *phone, *career;
+ char *strtok_pos;
strlcpy(justify_tmp, u->justify, sizeof(justify_tmp));
x.userlevel &= ~(PERM_LOGINOK | PERM_POST);
- phone = strtok(justify_tmp, ":");
- career = strtok(NULL, ":");
+ phone = strtok_r(justify_tmp, ":", &strtok_pos);
+ career = strtok_r(NULL, ":", &strtok_pos);
if (phone == NULL) phone = "";
if (career == NULL) career = "";