From 68a3c5c7677ca92bf22093fbfd123d4b0566a1a2 Mon Sep 17 00:00:00 2001 From: ptt Date: Wed, 31 Mar 2004 02:32:55 +0000 Subject: remove mmap of cuser git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1648 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 1 - mbbsd/passwd.c | 30 +++--------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) (limited to 'mbbsd') 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) { -- cgit v1.2.3