diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-01-06 20:06:52 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-01-06 20:06:52 +0800 |
commit | c6e1aac9084a22e7c19eaf21a82570b265ff07c3 (patch) | |
tree | b912807bfe12344c3229c9f76733e014cc28a136 | |
parent | 0abd9b3e52bc47a05af81c82aa054d60f7011019 (diff) | |
download | pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar.gz pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar.bz2 pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar.lz pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar.xz pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.tar.zst pttbbs-c6e1aac9084a22e7c19eaf21a82570b265ff07c3.zip |
fix an off-by-1 bug
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3465 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/bbs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 0103d742..e8d9fa02 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -595,12 +595,12 @@ void delete_allpost() { fileheader_t fhdr; - int fd, from; + int fd, i; char bdir[MAXPATHLEN]="", file[MAXPATHLEN]=""; setbdir(bdir, ALLPOST); if( (fd = open(bdir, O_RDWR)) != -1) { - for(from=0; read(fd, &fhdr, sizeof(fileheader_t)) >0; from++){ + for(i=0; read(fd, &fhdr, sizeof(fileheader_t)) >0; i++){ if(strcmp(fhdr.owner, cuser.userid)) continue; deleteCrossPost(&fhdr, ALLPOST); @@ -610,7 +610,7 @@ delete_allpost() sprintf(fhdr.title, "(本文已被刪除)"); strcpy(fhdr.filename, ".deleted"); strcpy(fhdr.owner, "-"); - lseek(fd, sizeof(fileheader_t) * (from - 1), SEEK_SET); + lseek(fd, sizeof(fileheader_t) * i, SEEK_SET); write(fd, &fhdr, sizeof(fileheader_t)); } close(fd); |