summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-15 17:13:48 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-15 17:13:48 +0800
commitb7fd178763c0c7519c3eb7bd281cd6113fd812bf (patch)
treeebf072f7a4f1ade2e978586ce90e515be9384f28
parent17f3a99403f991ad3e9a61bd5b6e6d36f9895cc5 (diff)
downloadpttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar.gz
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar.bz2
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar.lz
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar.xz
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.tar.zst
pttbbs-b7fd178763c0c7519c3eb7bd281cd6113fd812bf.zip
fix previous patch, logic error
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3174 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 6622adeb..b7aaa703 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1185,16 +1185,20 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
if(fhdr->textlen != newstat.st_size)
{
/* load and append tail data */
+ int gotnewstat = 0;
#ifdef DEBUG
vmsg("textlen != st_size, append tail.");
#endif
- if(stat(fpath, &newstat) != -1)
+ gotnewstat = stat(fpath, &newstat);
+ /* copy from old content. */
+ AppendTail(genbuf, fpath, fhdr->textlen);
+
+ /* now update the record. */
+ if(gotnewstat != -1)
fhdr->textlen = newstat.st_size;
else
fhdr->textlen = 0;
- AppendTail(genbuf, fpath, (fhdr->textlen > 0) ?
- fhdr->textlen-1 : 0);
}
} else /* old flavor, no textlen info */
if (oldstat.st_mtime != newstat.st_mtime)