diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-16 11:18:25 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-16 11:18:25 +0800 |
commit | 99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf (patch) | |
tree | 7c428a12d3dd1621635ceaf115027fe50e2f35f2 | |
parent | 50374a66e62e9b9471928726536efb86e316eb1d (diff) | |
download | pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar.gz pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar.bz2 pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar.lz pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar.xz pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.tar.zst pttbbs-99b0a1a8c53a7eef4347c7d9be8c425abaa4efbf.zip |
Check angel permission before starting conversation.
Adding MAP_PRIVATE flag when getting MAP_ANON from mmap().
(on Linux, without this flag causes EINVAL)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2197 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/stuff.c | 3 | ||||
-rw-r--r-- | mbbsd/talk.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index d35be51b..2f41f536 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -719,7 +719,8 @@ show_help(char * const helptext[]) void *MALLOC(int size) { int *p; - p = (int *)mmap(NULL, (size + 4), PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); + p = (int *)mmap(NULL, (size + 4), PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); p[0] = size; #if defined(DEBUG) && !defined(_BBS_UTIL_C_) vmsg("critical malloc %d bytes", size); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 40d44668..39e142ae 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -3028,6 +3028,14 @@ AngelNotOnline(){ static void TalkToAngel(){ userinfo_t* uent; + static int AngelPermChecked = 0; + + if (cuser.myangel[0] && !AngelPermChecked) { + getuser(cuser.myangel); + if (!(xuser.userlevel & PERM_ANGEL)) + cuser.myangel[0] = 0; + } + AngelPermChecked = 1; if (cuser.myangel[0] == 0 && ! FindAngel()){ NoAngelFound("現在沒有小天使在線上"); |