From beadf9e1734688d5bb7b7dd7a28db01697bbf214 Mon Sep 17 00:00:00 2001 From: ptt Date: Tue, 6 Apr 2004 17:29:51 +0000 Subject: money debug git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1713 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/passwd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mbbsd/passwd.c') 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) { -- cgit v1.2.3