summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-18 21:39:47 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-18 21:39:47 +0800
commitaf4fcde1441db15ab1365ef724196d3351a050b9 (patch)
treea8a37c1c666fff8ec2bf55ce606d5e709c923ff7
parent14b482f91f01afd45768a5658ceb853ea9653c3b (diff)
downloadpttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar.gz
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar.bz2
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar.lz
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar.xz
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.tar.zst
pttbbs-af4fcde1441db15ab1365ef724196d3351a050b9.zip
Opening wrong file. Remove the code and leave the racing.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1543 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index b6bb9e52..44003d91 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1485,7 +1485,9 @@ do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf)
return -1;
}
- get_record(path, fhdr, sizeof(fhdr), ent);
+ /* get_record(direct, fhdr, sizeof(fhdr), ent);
+ * This is a solution to avoid most racing (still some), but cost four
+ * system calls. */
if( fhdr->recommend < 100 ){
fileheader_t t;
@@ -1494,10 +1496,9 @@ do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf)
++(fhdr->recommend);
if( lseek(fd, (off_t)(sizeof(*fhdr) * (ent - 1) +
- (int)&t.recommend - (int)&t),
- SEEK_SET) < 0 ||
- write(fd, &fhdr->recommend, sizeof(char)) )
- ; // 如果 lseek 失敗就不會 write
+ (int)&t.recommend - (int)&t), SEEK_SET) >= 0)
+ // 如果 lseek 失敗就不會 write
+ write(fd, &fhdr->recommend, sizeof(char));
close(fd);
touchdircache(currbid);