summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-12 22:04:00 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-12 22:04:00 +0800
commite62883ad4fbaf62cc162be1ee5eb75358044beda (patch)
treeefc7bb04e867fb0abc35fab78061d05e907106ef
parentc1b70fdd69c6c025da4f04ad4dbd1b1fd253e75a (diff)
downloadpttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar.gz
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar.bz2
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar.lz
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar.xz
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.tar.zst
pttbbs-e62883ad4fbaf62cc162be1ee5eb75358044beda.zip
a small bug of lseek in do_add_recommend
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1962 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index d615f94c..50094bd3 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1341,8 +1341,8 @@ do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf, int type)
//Ptt: update only necessary
if( (fd = open(direct, O_WRONLY)) < 0 )
return -1;
- if( lseek(fd, (off_t)(sizeof(*fhdr) * (ent - 1) +
- (int)fhdr->recommend - (int)fhdr), SEEK_SET) >= 0)
+ if( lseek(fd, (off_t)(sizeof(fileheader_t) * (ent - 1) +
+ (int)&fhdr->recommend - (int)fhdr), SEEK_SET) >= 0)
// 如果 lseek 失敗就不會 write
write(fd, &fhdr->recommend, sizeof(char));