summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-31 10:32:55 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-31 10:32:55 +0800
commit68a3c5c7677ca92bf22093fbfd123d4b0566a1a2 (patch)
tree0b47ce1e41a24a75b54538f25d4414f256dfeec6 /mbbsd
parent435f181e8b560b2b987b163c3f776f21b74a3c7d (diff)
downloadpttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar.gz
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar.bz2
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar.lz
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar.xz
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.tar.zst
pttbbs-68a3c5c7677ca92bf22093fbfd123d4b0566a1a2.zip
remove mmap of cuser
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1648 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c1
-rw-r--r--mbbsd/passwd.c30
2 files changed, 3 insertions, 28 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 8d6219f4..5a4e35c8 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -178,7 +178,6 @@ u_exit(char *mode)
/* Leeym 上站停留時間限制式 */
}
passwd_index_update(usernum, cuser);
- freecuser();
log_usies(mode, NULL);
}
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 182040c8..4fb04652 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -57,11 +57,6 @@ passwd_update_money(int num) /* update money only */
if (num < 1 || num > MAX_USERS)
return -1;
- if (num == usernum)
- {
- cuser->money = money;
- return 0;
- }
sethomefile(path, getuserid(num), ".passwd");
@@ -127,36 +122,17 @@ passwd_index_query(int num, userec_t * buf)
return 0;
}
+userec_t userecbuf;
int initcuser(char *userid)
{
- int pwdfd;
- userec_t buf;
- char path[256];
// Ptt: setup cuser and usernum here
if(userid[0]=='\0') return -1;
if(!(usernum = searchuser(userid)) || usernum > MAX_USERS) return -1;
-
- sethomefile(path, userid, ".passwd");
- if((pwdfd = open(path, O_RDWR)) < 0)
- {
- if(passwd_index_query(usernum, &buf)<0)
- exit(1);
- passwd_update(usernum, &buf);
- if((pwdfd = open(path, O_RDWR)) < 0) exit(1);
- }
- cuser = (userec_t *) mmap(NULL, sizeof(userec_t), PROT_WRITE|PROT_READ,
- MAP_NOSYNC | MAP_SHARED, pwdfd, 0);
-
- if(cuser == (userec_t *) -1) exit(1);
- close(pwdfd);
+ passwd_query(usernum, &userecbuf);
+ cuser = &userecbuf;
return usernum;
}
-int freecuser()
-{
- return munmap(cuser, sizeof(userec_t));
-}
-
int
passwd_query(int num, userec_t * buf)
{