summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-07 01:29:51 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-07 01:29:51 +0800
commitbeadf9e1734688d5bb7b7dd7a28db01697bbf214 (patch)
treed29fe8fe3636efc93b8828b23c58d888d33a770e
parent80c4c81304e88d93f73efc42147793afbbfa43c5 (diff)
downloadpttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar.gz
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar.bz2
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar.lz
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar.xz
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.tar.zst
pttbbs-beadf9e1734688d5bb7b7dd7a28db01697bbf214.zip
money debug
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1713 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/passwd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index d33433b5..c2cb7aee 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -92,14 +92,15 @@ passwd_query_money(int num)
sethomefile(path, getuserid(num), ".passwd");
- if ((pwdfd = open(path, O_WRONLY)) < 0)
+ if ((pwdfd = open(path, O_RDONLY)) < 0)
{
if(passwd_index_query(num, &user)<0) // tempory code, will be removed
return 0;
return user.money;
}
if(lseek(pwdfd, (off_t)((int)&user.money - (int)&user), SEEK_SET) >= 0)
- read(pwdfd, &money, sizeof(int));
+ if(read(pwdfd, &money, sizeof(int))==-1)
+ money=0;
close(pwdfd);
if(money<0)
{