summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-31 01:16:30 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-03-31 01:16:30 +0800
commit6e73dec7f6f649a84e41c4a35c6655c9adef6acc (patch)
tree6449f775454dd52357ffe4f961639215467f13a8 /mbbsd
parent98acb18b8e6b7d7bfdd49809774e61328ef7f7a5 (diff)
downloadpttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar.gz
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar.bz2
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar.lz
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar.xz
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.tar.zst
pttbbs-6e73dec7f6f649a84e41c4a35c6655c9adef6acc.zip
debug of mmap
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1641 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/passwd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 95a3b39b..1a980e35 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -132,15 +132,15 @@ int initcuser(char *userid)
if(!(usernum = searchuser(userid)) || usernum > MAX_USERS) return -1;
sethomefile(path, userid, ".passwd");
- if((pwdfd = open(path, O_RDONLY)) < 0)
+ 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_RDONLY)) < 0) exit(1);
+ if((pwdfd = open(path, O_RDWR)) < 0) exit(1);
}
- cuser = (userec_t *) mmap(NULL, sizeof(userec_t), PROT_READ, MAP_SHARED,
- pwdfd, 0);
+ 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);