From e62883ad4fbaf62cc162be1ee5eb75358044beda Mon Sep 17 00:00:00 2001 From: ptt Date: Wed, 12 May 2004 14:04:00 +0000 Subject: 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 --- mbbsd/bbs.c | 4 ++-- 1 file 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)); -- cgit v1.2.3