diff options
-rw-r--r-- | mbbsd/bbs.c | 10 |
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) |