From b7fd178763c0c7519c3eb7bd281cd6113fd812bf Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 15 Sep 2005 09:13:48 +0000 Subject: fix previous patch, logic error git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3174 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 10 +++++++--- 1 file 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) -- cgit v1.2.3